Harmonize parameter names in pg_dump/pg_dumpall.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 22 Sep 2022 23:41:23 +0000 (16:41 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 22 Sep 2022 23:41:23 +0000 (16:41 -0700)
Make sure that function declarations use names that exactly match the
corresponding names from function definitions in pg_dump/pg_dumpall
related code.

Affected code happens to be inconsistent in how it applies conventions
around how Archive and Archive Handle variables are named.  Significant
code churn is required to fully fix those inconsistencies, so take the
least invasive approach possible: treat function definition names as
authoritative, and mechanically adjust corresponding names from function
definitions to match.

Like other recent commits that cleaned up function parameter names, this
commit was written with help from clang-tidy.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAH2-Wzmma+vzcO6gr5NYDZ+sx0G14aU-UrzFutT2FoRaisVCUQ@mail.gmail.com

src/bin/pg_dump/common.c
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_directory.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dumpall.c

index 395f817fa8f103639bf8b17a938f148d817201ea..44fa52cc55febf992d7227acf8449f1706331523 100644 (file)
@@ -79,7 +79,7 @@ typedef struct _catalogIdMapEntry
 
 static catalogid_hash *catalogIdHash = NULL;
 
-static void flagInhTables(Archive *fout, TableInfo *tbinfo, int numTables,
+static void flagInhTables(Archive *fout, TableInfo *tblinfo, int numTables,
                                                  InhInfo *inhinfo, int numInherits);
 static void flagInhIndexes(Archive *fout, TableInfo *tblinfo, int numTables);
 static void flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables);
index fcc5f6bd05647550bed24f82648e99edf125f51f..e8b78982971eb7d01aba93103195194249909d82 100644 (file)
@@ -285,18 +285,18 @@ extern void DisconnectDatabase(Archive *AHX);
 extern PGconn *GetConnection(Archive *AHX);
 
 /* Called to write *data* to the archive */
-extern void WriteData(Archive *AH, const void *data, size_t dLen);
+extern void WriteData(Archive *AHX, const void *data, size_t dLen);
 
-extern int     StartBlob(Archive *AH, Oid oid);
-extern int     EndBlob(Archive *AH, Oid oid);
+extern int     StartBlob(Archive *AHX, Oid oid);
+extern int     EndBlob(Archive *AHX, Oid oid);
 
-extern void CloseArchive(Archive *AH);
+extern void CloseArchive(Archive *AHX);
 
 extern void SetArchiveOptions(Archive *AH, DumpOptions *dopt, RestoreOptions *ropt);
 
-extern void ProcessArchiveRestoreOptions(Archive *AH);
+extern void ProcessArchiveRestoreOptions(Archive *AHX);
 
-extern void RestoreArchive(Archive *AH);
+extern void RestoreArchive(Archive *AHX);
 
 /* Open an existing archive */
 extern Archive *OpenArchive(const char *FileSpec, const ArchiveFormat fmt);
@@ -307,7 +307,7 @@ extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fmt,
                                                          SetupWorkerPtrType setupDumpWorker);
 
 /* The --list option */
-extern void PrintTOCSummary(Archive *AH);
+extern void PrintTOCSummary(Archive *AHX);
 
 extern RestoreOptions *NewRestoreOptions(void);
 
index 084cd87e8d7fe36e2988d156b4853830d4616dd3..42687c4ec835dec2ae9752992eb818610e0592c0 100644 (file)
@@ -457,7 +457,7 @@ extern bool checkSeek(FILE *fp);
 extern size_t WriteInt(ArchiveHandle *AH, int i);
 extern int     ReadInt(ArchiveHandle *AH);
 extern char *ReadStr(ArchiveHandle *AH);
-extern size_t WriteStr(ArchiveHandle *AH, const char *s);
+extern size_t WriteStr(ArchiveHandle *AH, const char *c);
 
 int                    ReadOffset(ArchiveHandle *, pgoff_t *);
 size_t         WriteOffset(ArchiveHandle *, pgoff_t, int);
index 1023fea01b209101ddd4514d2fa67e72036c7a36..a0a55a1edd09e1e794bad61be3dc9507ad12f80e 100644 (file)
@@ -40,7 +40,7 @@ static void _StartData(ArchiveHandle *AH, TocEntry *te);
 static void _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
-static int     _ReadByte(ArchiveHandle *);
+static int     _ReadByte(ArchiveHandle *AH);
 static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
 static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
index 3f46f7988a12ebad20b80e77d4b9eaa04a4df52a..798182b6f7ebc3ed2df788d1a57c549cb048e1bf 100644 (file)
@@ -67,7 +67,7 @@ static void _StartData(ArchiveHandle *AH, TocEntry *te);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static void _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
-static int     _ReadByte(ArchiveHandle *);
+static int     _ReadByte(ArchiveHandle *AH);
 static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
 static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
index 7960b81c0e6d83ea93f8f1242f1b57a4bc8334d1..402b93c610aed1356bdd1c9fad6744b8cc01a053 100644 (file)
@@ -46,7 +46,7 @@ static void _StartData(ArchiveHandle *AH, TocEntry *te);
 static void _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
-static int     _ReadByte(ArchiveHandle *);
+static int     _ReadByte(ArchiveHandle *AH);
 static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
 static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
@@ -97,7 +97,7 @@ typedef struct
 static void _LoadBlobs(ArchiveHandle *AH);
 
 static TAR_MEMBER *tarOpen(ArchiveHandle *AH, const char *filename, char mode);
-static void tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
+static void tarClose(ArchiveHandle *AH, TAR_MEMBER *th);
 
 #ifdef __NOT_USED__
 static char *tarGets(char *buf, size_t len, TAR_MEMBER *th);
index 65a5c5ec4c89feb307736680263321877568c0a2..f8c4cb8d183d142f737f92ccd9e5d3f4e36e64ab 100644 (file)
@@ -221,7 +221,7 @@ static void dumpFunc(Archive *fout, const FuncInfo *finfo);
 static void dumpCast(Archive *fout, const CastInfo *cast);
 static void dumpTransform(Archive *fout, const TransformInfo *transform);
 static void dumpOpr(Archive *fout, const OprInfo *oprinfo);
-static void dumpAccessMethod(Archive *fout, const AccessMethodInfo *oprinfo);
+static void dumpAccessMethod(Archive *fout, const AccessMethodInfo *aminfo);
 static void dumpOpclass(Archive *fout, const OpclassInfo *opcinfo);
 static void dumpOpfamily(Archive *fout, const OpfamilyInfo *opfinfo);
 static void dumpCollation(Archive *fout, const CollInfo *collinfo);
@@ -232,7 +232,7 @@ static void dumpTrigger(Archive *fout, const TriggerInfo *tginfo);
 static void dumpEventTrigger(Archive *fout, const EventTriggerInfo *evtinfo);
 static void dumpTable(Archive *fout, const TableInfo *tbinfo);
 static void dumpTableSchema(Archive *fout, const TableInfo *tbinfo);
-static void dumpTableAttach(Archive *fout, const TableAttachInfo *tbinfo);
+static void dumpTableAttach(Archive *fout, const TableAttachInfo *attachinfo);
 static void dumpAttrDef(Archive *fout, const AttrDefInfo *adinfo);
 static void dumpSequence(Archive *fout, const TableInfo *tbinfo);
 static void dumpSequenceData(Archive *fout, const TableDataInfo *tdinfo);
@@ -287,7 +287,7 @@ static void dumpPolicy(Archive *fout, const PolicyInfo *polinfo);
 static void dumpPublication(Archive *fout, const PublicationInfo *pubinfo);
 static void dumpPublicationTable(Archive *fout, const PublicationRelInfo *pubrinfo);
 static void dumpSubscription(Archive *fout, const SubscriptionInfo *subinfo);
-static void dumpDatabase(Archive *AH);
+static void dumpDatabase(Archive *fout);
 static void dumpDatabaseConfig(Archive *AH, PQExpBuffer outbuf,
                                                           const char *dbname, Oid dboid);
 static void dumpEncoding(Archive *AH);
@@ -315,7 +315,7 @@ static bool nonemptyReloptions(const char *reloptions);
 static void appendReloptionsArrayAH(PQExpBuffer buffer, const char *reloptions,
                                                                        const char *prefix, Archive *fout);
 static char *get_synchronized_snapshot(Archive *fout);
-static void setupDumpWorker(Archive *AHX);
+static void setupDumpWorker(Archive *AH);
 static TableInfo *getRootTableInfo(const TableInfo *tbinfo);
 
 
index 69ee939d4497528ff05b69b1af9c550a368af876..427f5d45f65b8db388657995bfaa7ebbe8266715 100644 (file)
@@ -705,8 +705,8 @@ extern NamespaceInfo *getNamespaces(Archive *fout, int *numNamespaces);
 extern ExtensionInfo *getExtensions(Archive *fout, int *numExtensions);
 extern TypeInfo *getTypes(Archive *fout, int *numTypes);
 extern FuncInfo *getFuncs(Archive *fout, int *numFuncs);
-extern AggInfo *getAggregates(Archive *fout, int *numAggregates);
-extern OprInfo *getOperators(Archive *fout, int *numOperators);
+extern AggInfo *getAggregates(Archive *fout, int *numAggs);
+extern OprInfo *getOperators(Archive *fout, int *numOprs);
 extern AccessMethodInfo *getAccessMethods(Archive *fout, int *numAccessMethods);
 extern OpclassInfo *getOpclasses(Archive *fout, int *numOpclasses);
 extern OpfamilyInfo *getOpfamilies(Archive *fout, int *numOpfamilies);
@@ -723,7 +723,7 @@ extern void getTriggers(Archive *fout, TableInfo tblinfo[], int numTables);
 extern ProcLangInfo *getProcLangs(Archive *fout, int *numProcLangs);
 extern CastInfo *getCasts(Archive *fout, int *numCasts);
 extern TransformInfo *getTransforms(Archive *fout, int *numTransforms);
-extern void getTableAttrs(Archive *fout, TableInfo *tbinfo, int numTables);
+extern void getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables);
 extern bool shouldPrintColumn(const DumpOptions *dopt, const TableInfo *tbinfo, int colno);
 extern TSParserInfo *getTSParsers(Archive *fout, int *numTSParsers);
 extern TSDictInfo *getTSDictionaries(Archive *fout, int *numTSDicts);
index 69ae027bd3815a3919836d15a727572557da4ab5..083012ca39d50a1267a9914af8315e37cada22dc 100644 (file)
@@ -72,8 +72,10 @@ static void buildShSecLabels(PGconn *conn,
                                                         const char *catalog_name, Oid objectId,
                                                         const char *objtype, const char *objname,
                                                         PQExpBuffer buffer);
-static PGconn *connectDatabase(const char *dbname, const char *connstr, const char *pghost, const char *pgport,
-                                                          const char *pguser, trivalue prompt_password, bool fail_on_error);
+static PGconn *connectDatabase(const char *dbname,
+                                                          const char *connection_string, const char *pghost,
+                                                          const char *pgport, const char *pguser,
+                                                          trivalue prompt_password, bool fail_on_error);
 static char *constructConnStr(const char **keywords, const char **values);
 static PGresult *executeQuery(PGconn *conn, const char *query);
 static void executeCommand(PGconn *conn, const char *query);