From 322272db4bb9e991035cd8980c6d2a495c2166e1 Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Tue, 2 Dec 2025 14:59:43 +0800 Subject: [PATCH v5 07/13] cleanup: rename local progname variables to avoid shadowing the global This commit updates all functions that declared a local variable named 'progname', renaming each to 'myprogname'. The change prevents shadowing of the global progname variable and keeps identifier usage unambiguous within each scope. A few additional shadowing fixes in the same files are included as well. These unrelated cases are addressed here only because they occur in the same code locations touched by the progname change, and bundling them keeps the commit self-contained. Author: Chao Li Discussion: https://postgr.es/m/CAEoWx2kQ2x5gMaj8tHLJ3=jfC+p5YXHkJyHrDTiQw2nn2FJTmQ@mail.gmail.com --- src/backend/bootstrap/bootstrap.c | 8 +- src/backend/main/main.c | 14 ++-- src/bin/initdb/initdb.c | 60 +++++++------- src/bin/pg_amcheck/pg_amcheck.c | 6 +- src/bin/pg_basebackup/pg_createsubscriber.c | 14 ++-- src/bin/pg_dump/connectdb.c | 4 +- src/bin/pg_dump/pg_dump.c | 90 ++++++++++----------- src/bin/pg_dump/pg_restore.c | 6 +- src/bin/pg_rewind/pg_rewind.c | 22 ++--- src/interfaces/ecpg/preproc/ecpg.c | 6 +- 10 files changed, 115 insertions(+), 115 deletions(-) diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index fc8638c1b61..f649c00113d 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -200,7 +200,7 @@ void BootstrapModeMain(int argc, char *argv[], bool check_only) { int i; - char *progname = argv[0]; + char *myprogname = argv[0]; int flag; char *userDoption = NULL; uint32 bootstrap_data_checksum_version = 0; /* No checksum */ @@ -296,7 +296,7 @@ BootstrapModeMain(int argc, char *argv[], bool check_only) break; default: write_stderr("Try \"%s --help\" for more information.\n", - progname); + myprogname); proc_exit(1); break; } @@ -304,12 +304,12 @@ BootstrapModeMain(int argc, char *argv[], bool check_only) if (argc != optind) { - write_stderr("%s: invalid command-line arguments\n", progname); + write_stderr("%s: invalid command-line arguments\n", myprogname); proc_exit(1); } /* Acquire configuration parameters */ - if (!SelectConfigFiles(userDoption, progname)) + if (!SelectConfigFiles(userDoption, myprogname)) proc_exit(1); /* diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 72aaee36a68..eeb64d09608 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -281,7 +281,7 @@ parse_dispatch_option(const char *name) * without help. Avoid adding more here, if you can. */ static void -startup_hacks(const char *progname) +startup_hacks(const char *myprogname) { /* * Windows-specific execution environment hacking. @@ -300,7 +300,7 @@ startup_hacks(const char *progname) if (err != 0) { write_stderr("%s: WSAStartup failed: %d\n", - progname, err); + myprogname, err); exit(1); } @@ -385,10 +385,10 @@ init_locale(const char *categoryname, int category, const char *locale) * Messages emitted in write_console() do not exhibit this problem. */ static void -help(const char *progname) +help(const char *myprogname) { - printf(_("%s is the PostgreSQL server.\n\n"), progname); - printf(_("Usage:\n %s [OPTION]...\n\n"), progname); + printf(_("%s is the PostgreSQL server.\n\n"), myprogname); + printf(_("Usage:\n %s [OPTION]...\n\n"), myprogname); printf(_("Options:\n")); printf(_(" -B NBUFFERS number of shared buffers\n")); printf(_(" -c NAME=VALUE set run-time parameter\n")); @@ -444,7 +444,7 @@ help(const char *progname) static void -check_root(const char *progname) +check_root(const char *myprogname) { #ifndef WIN32 if (geteuid() == 0) @@ -467,7 +467,7 @@ check_root(const char *progname) if (getuid() != geteuid()) { write_stderr("%s: real and effective user IDs must match\n", - progname); + myprogname); exit(1); } #else /* WIN32 */ diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 92fe2f531f7..d8e95ca2fe1 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -814,7 +814,7 @@ cleanup_directories_atexit(void) static char * get_id(void) { - const char *username; + const char *user; #ifndef WIN32 if (geteuid() == 0) /* 0 is root's uid */ @@ -825,9 +825,9 @@ get_id(void) } #endif - username = get_user_name_or_exit(progname); + user = get_user_name_or_exit(progname); - return pg_strdup(username); + return pg_strdup(user); } static char * @@ -1046,14 +1046,14 @@ write_version_file(const char *extrapath) static void set_null_conf(void) { - FILE *conf_file; + FILE *file; char *path; path = psprintf("%s/postgresql.conf", pg_data); - conf_file = fopen(path, PG_BINARY_W); - if (conf_file == NULL) + file = fopen(path, PG_BINARY_W); + if (file == NULL) pg_fatal("could not open file \"%s\" for writing: %m", path); - if (fclose(conf_file)) + if (fclose(file)) pg_fatal("could not write file \"%s\": %m", path); free(path); } @@ -2137,7 +2137,7 @@ my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm) * Determine likely date order from locale */ static int -locale_date_order(const char *locale) +locale_date_order(const char *mylocale) { struct tm testtime; char buf[128]; @@ -2152,7 +2152,7 @@ locale_date_order(const char *locale) save = save_global_locale(LC_TIME); - setlocale(LC_TIME, locale); + setlocale(LC_TIME, mylocale); memset(&testtime, 0, sizeof(testtime)); testtime.tm_mday = 22; @@ -2196,14 +2196,14 @@ locale_date_order(const char *locale) * this should match the backend's check_locale() function */ static void -check_locale_name(int category, const char *locale, char **canonname) +check_locale_name(int category, const char *mylocale, char **canonname) { save_locale_t save; char *res; /* Don't let Windows' non-ASCII locale names in. */ - if (locale && !pg_is_ascii(locale)) - pg_fatal("locale name \"%s\" contains non-ASCII characters", locale); + if (mylocale && !pg_is_ascii(mylocale)) + pg_fatal("locale name \"%s\" contains non-ASCII characters", mylocale); if (canonname) *canonname = NULL; /* in case of failure */ @@ -2211,11 +2211,11 @@ check_locale_name(int category, const char *locale, char **canonname) save = save_global_locale(category); /* for setlocale() call */ - if (!locale) - locale = ""; + if (!mylocale) + mylocale = ""; /* set the locale with setlocale, to see if it accepts it. */ - res = setlocale(category, locale); + res = setlocale(category, mylocale); /* save canonical name if requested. */ if (res && canonname) @@ -2227,9 +2227,9 @@ check_locale_name(int category, const char *locale, char **canonname) /* complain if locale wasn't valid */ if (res == NULL) { - if (*locale) + if (*mylocale) { - pg_log_error("invalid locale name \"%s\"", locale); + pg_log_error("invalid locale name \"%s\"", mylocale); pg_log_error_hint("If the locale name is specific to ICU, use --icu-locale."); exit(1); } @@ -2259,11 +2259,11 @@ check_locale_name(int category, const char *locale, char **canonname) * this should match the similar check in the backend createdb() function */ static bool -check_locale_encoding(const char *locale, int user_enc) +check_locale_encoding(const char *mylocale, int user_enc) { int locale_enc; - locale_enc = pg_get_encoding_from_locale(locale, true); + locale_enc = pg_get_encoding_from_locale(mylocale, true); /* See notes in createdb() to understand these tests */ if (!(locale_enc == user_enc || @@ -2511,11 +2511,11 @@ setlocales(void) * print help text */ static void -usage(const char *progname) +usage(const char *myprogname) { - printf(_("%s initializes a PostgreSQL database cluster.\n\n"), progname); + printf(_("%s initializes a PostgreSQL database cluster.\n\n"), myprogname); printf(_("Usage:\n")); - printf(_(" %s [OPTION]... [DATADIR]\n"), progname); + printf(_(" %s [OPTION]... [DATADIR]\n"), myprogname); printf(_("\nOptions:\n")); printf(_(" -A, --auth=METHOD default authentication method for local connections\n")); printf(_(" --auth-host=METHOD default authentication method for local TCP/IP connections\n")); @@ -2591,14 +2591,14 @@ check_authmethod_valid(const char *authmethod, const char *const *valid_methods, } static void -check_need_password(const char *authmethodlocal, const char *authmethodhost) -{ - if ((strcmp(authmethodlocal, "md5") == 0 || - strcmp(authmethodlocal, "password") == 0 || - strcmp(authmethodlocal, "scram-sha-256") == 0) && - (strcmp(authmethodhost, "md5") == 0 || - strcmp(authmethodhost, "password") == 0 || - strcmp(authmethodhost, "scram-sha-256") == 0) && +check_need_password(const char *myauthmethodlocal, const char *myauthmethodhost) +{ + if ((strcmp(myauthmethodlocal, "md5") == 0 || + strcmp(myauthmethodlocal, "password") == 0 || + strcmp(myauthmethodlocal, "scram-sha-256") == 0) && + (strcmp(myauthmethodhost, "md5") == 0 || + strcmp(myauthmethodhost, "password") == 0 || + strcmp(myauthmethodhost, "scram-sha-256") == 0) && !(pwprompt || pwfilename)) pg_fatal("must specify a password for the superuser to enable password authentication"); } diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c index 2b1fd566c35..06a97712e18 100644 --- a/src/bin/pg_amcheck/pg_amcheck.c +++ b/src/bin/pg_amcheck/pg_amcheck.c @@ -1180,11 +1180,11 @@ verify_btree_slot_handler(PGresult *res, PGconn *conn, void *context) * progname: the name of the executed program, such as "pg_amcheck" */ static void -help(const char *progname) +help(const char *myprogname) { - printf(_("%s checks objects in a PostgreSQL database for corruption.\n\n"), progname); + printf(_("%s checks objects in a PostgreSQL database for corruption.\n\n"), myprogname); printf(_("Usage:\n")); - printf(_(" %s [OPTION]... [DBNAME]\n"), progname); + printf(_(" %s [OPTION]... [DBNAME]\n"), myprogname); printf(_("\nTarget options:\n")); printf(_(" -a, --all check all databases\n")); printf(_(" -d, --database=PATTERN check matching database(s)\n")); diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index 43dc6ff7693..04210e60bca 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -363,32 +363,32 @@ get_sub_conninfo(const struct CreateSubscriberOptions *opt) * path of the progname. */ static char * -get_exec_path(const char *argv0, const char *progname) +get_exec_path(const char *argv0, const char *myprogname) { char *versionstr; char *exec_path; int ret; - versionstr = psprintf("%s (PostgreSQL) %s\n", progname, PG_VERSION); + versionstr = psprintf("%s (PostgreSQL) %s\n", myprogname, PG_VERSION); exec_path = pg_malloc(MAXPGPATH); - ret = find_other_exec(argv0, progname, versionstr, exec_path); + ret = find_other_exec(argv0, myprogname, versionstr, exec_path); if (ret < 0) { char full_path[MAXPGPATH]; if (find_my_exec(argv0, full_path) < 0) - strlcpy(full_path, progname, sizeof(full_path)); + strlcpy(full_path, myprogname, sizeof(full_path)); if (ret == -1) pg_fatal("program \"%s\" is needed by %s but was not found in the same directory as \"%s\"", - progname, "pg_createsubscriber", full_path); + myprogname, "pg_createsubscriber", full_path); else pg_fatal("program \"%s\" was found by \"%s\" but was not the same version as %s", - progname, full_path, "pg_createsubscriber"); + myprogname, full_path, "pg_createsubscriber"); } - pg_log_debug("%s path is: %s", progname, exec_path); + pg_log_debug("%s path is: %s", myprogname, exec_path); return exec_path; } diff --git a/src/bin/pg_dump/connectdb.c b/src/bin/pg_dump/connectdb.c index d55d53dbeea..a2a1bad254b 100644 --- a/src/bin/pg_dump/connectdb.c +++ b/src/bin/pg_dump/connectdb.c @@ -39,7 +39,7 @@ static char *constructConnStr(const char **keywords, const char **values); 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, const char *progname, + trivalue prompt_password, bool fail_on_error, const char *myprogname, const char **connstr, int *server_version, char *password, char *override_dbname) { @@ -221,7 +221,7 @@ ConnectDatabase(const char *dbname, const char *connection_string, { pg_log_error("aborting because of server version mismatch"); pg_log_error_detail("server version: %s; %s version: %s", - remoteversion_str, progname, PG_VERSION); + remoteversion_str, myprogname, PG_VERSION); exit_nicely(1); } diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 2445085dbbd..d2b54916a0e 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -1301,11 +1301,11 @@ main(int argc, char **argv) static void -help(const char *progname) +help(const char *myprogname) { - printf(_("%s exports a PostgreSQL database as an SQL script or to other formats.\n\n"), progname); + printf(_("%s exports a PostgreSQL database as an SQL script or to other formats.\n\n"), myprogname); printf(_("Usage:\n")); - printf(_(" %s [OPTION]... [DBNAME]\n"), progname); + printf(_(" %s [OPTION]... [DBNAME]\n"), myprogname); printf(_("\nGeneral options:\n")); printf(_(" -f, --file=FILENAME output file or directory name\n")); @@ -1649,7 +1649,7 @@ static void expand_schema_name_patterns(Archive *fout, SimpleStringList *patterns, SimpleOidList *oids, - bool strict_names) + bool strict) { PQExpBuffer query; PGresult *res; @@ -1685,7 +1685,7 @@ expand_schema_name_patterns(Archive *fout, termPQExpBuffer(&dbbuf); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); - if (strict_names && PQntuples(res) == 0) + if (strict && PQntuples(res) == 0) pg_fatal("no matching schemas were found for pattern \"%s\"", cell->val); for (i = 0; i < PQntuples(res); i++) @@ -1708,7 +1708,7 @@ static void expand_extension_name_patterns(Archive *fout, SimpleStringList *patterns, SimpleOidList *oids, - bool strict_names) + bool strict) { PQExpBuffer query; PGresult *res; @@ -1738,7 +1738,7 @@ expand_extension_name_patterns(Archive *fout, cell->val); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); - if (strict_names && PQntuples(res) == 0) + if (strict && PQntuples(res) == 0) pg_fatal("no matching extensions were found for pattern \"%s\"", cell->val); for (i = 0; i < PQntuples(res); i++) @@ -1812,7 +1812,7 @@ expand_foreign_server_name_patterns(Archive *fout, static void expand_table_name_patterns(Archive *fout, SimpleStringList *patterns, SimpleOidList *oids, - bool strict_names, bool with_child_tables) + bool strict, bool with_child_tables) { PQExpBuffer query; PGresult *res; @@ -1884,7 +1884,7 @@ expand_table_name_patterns(Archive *fout, res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); PQclear(ExecuteSqlQueryForSingleRow(fout, ALWAYS_SECURE_SEARCH_PATH_SQL)); - if (strict_names && PQntuples(res) == 0) + if (strict && PQntuples(res) == 0) pg_fatal("no matching tables were found for pattern \"%s\"", cell->val); for (i = 0; i < PQntuples(res); i++) @@ -10870,8 +10870,8 @@ dumpCommentExtended(Archive *fout, const char *type, const char *initdb_comment) { DumpOptions *dopt = fout->dopt; - CommentItem *comments; - int ncomments; + CommentItem *comment_items; + int n_comment_items; /* do nothing, if --no-comments is supplied */ if (dopt->no_comments) @@ -10891,16 +10891,16 @@ dumpCommentExtended(Archive *fout, const char *type, } /* Search for comments associated with catalogId, using table */ - ncomments = findComments(catalogId.tableoid, catalogId.oid, - &comments); + n_comment_items = findComments(catalogId.tableoid, catalogId.oid, + &comment_items); /* Is there one matching the subid? */ - while (ncomments > 0) + while (n_comment_items > 0) { - if (comments->objsubid == subid) + if (comment_items->objsubid == subid) break; - comments++; - ncomments--; + comment_items++; + n_comment_items--; } if (initdb_comment != NULL) @@ -10913,17 +10913,17 @@ dumpCommentExtended(Archive *fout, const char *type, * non-superuser use of pg_dump. When the DBA has removed initdb's * comment, replicate that. */ - if (ncomments == 0) + if (n_comment_items == 0) { - comments = &empty_comment; - ncomments = 1; + comment_items = &empty_comment; + n_comment_items = 1; } - else if (strcmp(comments->descr, initdb_comment) == 0) - ncomments = 0; + else if (strcmp(comment_items->descr, initdb_comment) == 0) + n_comment_items = 0; } /* If a comment exists, build COMMENT ON statement */ - if (ncomments > 0) + if (n_comment_items > 0) { PQExpBuffer query = createPQExpBuffer(); PQExpBuffer tag = createPQExpBuffer(); @@ -10932,7 +10932,7 @@ dumpCommentExtended(Archive *fout, const char *type, if (namespace && *namespace) appendPQExpBuffer(query, "%s.", fmtId(namespace)); appendPQExpBuffer(query, "%s IS ", name); - appendStringLiteralAH(query, comments->descr, fout); + appendStringLiteralAH(query, comment_items->descr, fout); appendPQExpBufferStr(query, ";\n"); appendPQExpBuffer(tag, "%s %s", type, name); @@ -11388,8 +11388,8 @@ dumpTableComment(Archive *fout, const TableInfo *tbinfo, const char *reltypename) { DumpOptions *dopt = fout->dopt; - CommentItem *comments; - int ncomments; + CommentItem *comment_items; + int n_comment_items; PQExpBuffer query; PQExpBuffer tag; @@ -11402,21 +11402,21 @@ dumpTableComment(Archive *fout, const TableInfo *tbinfo, return; /* Search for comments associated with relation, using table */ - ncomments = findComments(tbinfo->dobj.catId.tableoid, - tbinfo->dobj.catId.oid, - &comments); + n_comment_items = findComments(tbinfo->dobj.catId.tableoid, + tbinfo->dobj.catId.oid, + &comment_items); /* If comments exist, build COMMENT ON statements */ - if (ncomments <= 0) + if (n_comment_items <= 0) return; query = createPQExpBuffer(); tag = createPQExpBuffer(); - while (ncomments > 0) + while (n_comment_items > 0) { - const char *descr = comments->descr; - int objsubid = comments->objsubid; + const char *descr = comment_items->descr; + int objsubid = comment_items->objsubid; if (objsubid == 0) { @@ -11466,8 +11466,8 @@ dumpTableComment(Archive *fout, const TableInfo *tbinfo, .nDeps = 1)); } - comments++; - ncomments--; + comment_items++; + n_comment_items--; } destroyPQExpBuffer(query); @@ -13116,8 +13116,8 @@ static void dumpCompositeTypeColComments(Archive *fout, const TypeInfo *tyinfo, PGresult *res) { - CommentItem *comments; - int ncomments; + CommentItem *comment_items; + int n_comment_items; PQExpBuffer query; PQExpBuffer target; int i; @@ -13131,11 +13131,11 @@ dumpCompositeTypeColComments(Archive *fout, const TypeInfo *tyinfo, return; /* Search for comments associated with type's pg_class OID */ - ncomments = findComments(RelationRelationId, tyinfo->typrelid, - &comments); + n_comment_items = findComments(RelationRelationId, tyinfo->typrelid, + &comment_items); /* If no comments exist, we're done */ - if (ncomments <= 0) + if (n_comment_items <= 0) return; /* Build COMMENT ON statements */ @@ -13146,14 +13146,14 @@ dumpCompositeTypeColComments(Archive *fout, const TypeInfo *tyinfo, i_attnum = PQfnumber(res, "attnum"); i_attname = PQfnumber(res, "attname"); i_attisdropped = PQfnumber(res, "attisdropped"); - while (ncomments > 0) + while (n_comment_items > 0) { const char *attname; attname = NULL; for (i = 0; i < ntups; i++) { - if (atoi(PQgetvalue(res, i, i_attnum)) == comments->objsubid && + if (atoi(PQgetvalue(res, i, i_attnum)) == comment_items->objsubid && PQgetvalue(res, i, i_attisdropped)[0] != 't') { attname = PQgetvalue(res, i, i_attname); @@ -13162,7 +13162,7 @@ dumpCompositeTypeColComments(Archive *fout, const TypeInfo *tyinfo, } if (attname) /* just in case we don't find it */ { - const char *descr = comments->descr; + const char *descr = comment_items->descr; resetPQExpBuffer(target); appendPQExpBuffer(target, "COLUMN %s.", @@ -13187,8 +13187,8 @@ dumpCompositeTypeColComments(Archive *fout, const TypeInfo *tyinfo, .nDeps = 1)); } - comments++; - ncomments--; + comment_items++; + n_comment_items--; } destroyPQExpBuffer(query); diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index c9776306c5c..5f778ec9e77 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -517,11 +517,11 @@ main(int argc, char **argv) } static void -usage(const char *progname) +usage(const char *myprogname) { - printf(_("%s restores a PostgreSQL database from an archive created by pg_dump.\n\n"), progname); + printf(_("%s restores a PostgreSQL database from an archive created by pg_dump.\n\n"), myprogname); printf(_("Usage:\n")); - printf(_(" %s [OPTION]... [FILE]\n"), progname); + printf(_(" %s [OPTION]... [FILE]\n"), myprogname); printf(_("\nGeneral options:\n")); printf(_(" -d, --dbname=NAME connect to database name\n")); diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index e9364d04f76..4bacd9e9d34 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -89,9 +89,9 @@ static PGconn *conn; static rewind_source *source; static void -usage(const char *progname) +usage(const char *myprogname) { - printf(_("%s resynchronizes a PostgreSQL cluster with another copy of the cluster.\n\n"), progname); + printf(_("%s resynchronizes a PostgreSQL cluster with another copy of the cluster.\n\n"), myprogname); printf(_("Usage:\n %s [OPTION]...\n\n"), progname); printf(_("Options:\n")); printf(_(" -c, --restore-target-wal use \"restore_command\" in target configuration to\n" @@ -561,7 +561,7 @@ main(int argc, char **argv) * target and the source. */ static void -perform_rewind(filemap_t *filemap, rewind_source *source, +perform_rewind(filemap_t *filemap, rewind_source *rewindsource, XLogRecPtr chkptrec, TimeLineID chkpttli, XLogRecPtr chkptredo) @@ -595,7 +595,7 @@ perform_rewind(filemap_t *filemap, rewind_source *source, while (datapagemap_next(iter, &blkno)) { offset = blkno * BLCKSZ; - source->queue_fetch_range(source, entry->path, offset, BLCKSZ); + rewindsource->queue_fetch_range(rewindsource, entry->path, offset, BLCKSZ); } pg_free(iter); } @@ -607,7 +607,7 @@ perform_rewind(filemap_t *filemap, rewind_source *source, break; case FILE_ACTION_COPY: - source->queue_fetch_file(source, entry->path, entry->source_size); + rewindsource->queue_fetch_file(rewindsource, entry->path, entry->source_size); break; case FILE_ACTION_TRUNCATE: @@ -615,9 +615,9 @@ perform_rewind(filemap_t *filemap, rewind_source *source, break; case FILE_ACTION_COPY_TAIL: - source->queue_fetch_range(source, entry->path, - entry->target_size, - entry->source_size - entry->target_size); + rewindsource->queue_fetch_range(rewindsource, entry->path, + entry->target_size, + entry->source_size - entry->target_size); break; case FILE_ACTION_REMOVE: @@ -635,7 +635,7 @@ perform_rewind(filemap_t *filemap, rewind_source *source, } /* Complete any remaining range-fetches that we queued up above. */ - source->finish_fetch(source); + rewindsource->finish_fetch(rewindsource); close_target_file(); @@ -645,7 +645,7 @@ perform_rewind(filemap_t *filemap, rewind_source *source, * Fetch the control file from the source last. This ensures that the * minRecoveryPoint is up-to-date. */ - buffer = source->fetch_file(source, XLOG_CONTROL_FILE, &size); + buffer = rewindsource->fetch_file(rewindsource, XLOG_CONTROL_FILE, &size); digestControlFile(&ControlFile_source_after, buffer, size); pg_free(buffer); @@ -717,7 +717,7 @@ perform_rewind(filemap_t *filemap, rewind_source *source, if (ControlFile_source_after.state != DB_IN_PRODUCTION) pg_fatal("source system was in unexpected state at end of rewind"); - endrec = source->get_current_wal_insert_lsn(source); + endrec = rewindsource->get_current_wal_insert_lsn(rewindsource); endtli = Max(ControlFile_source_after.checkPointCopy.ThisTimeLineID, ControlFile_source_after.minRecoveryPointTLI); } diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 3f0f10e654a..525988a2302 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -32,13 +32,13 @@ struct _defines *defines = NULL; struct declared_list *g_declared_list = NULL; static void -help(const char *progname) +help(const char *myprogname) { printf(_("%s is the PostgreSQL embedded SQL preprocessor for C programs.\n\n"), - progname); + myprogname); printf(_("Usage:\n" " %s [OPTION]... FILE...\n\n"), - progname); + myprogname); printf(_("Options:\n")); printf(_(" -c automatically generate C code from embedded SQL code;\n" " this affects EXEC SQL TYPE\n")); -- 2.39.5 (Apple Git-154)