This the second version of the global unshadow patch.
Taking into consideration made. In case anyone else revises.
regards
Ranier Vilela
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 6bc1a6b46d..83be23d77b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -892,8 +892,8 @@ static int emode_for_corrupt_record(int emode, XLogRecPtr RecPtr);
static void XLogFileClose(void);
static void PreallocXlogFiles(XLogRecPtr endptr);
static void RemoveTempXlogFiles(void);
-static void RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr RedoRecPtr, XLogRecPtr endptr);
-static void RemoveXlogFile(const char *segname, XLogRecPtr RedoRecPtr, XLogRecPtr endptr);
+static void RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr lastRedoRecPtr, XLogRecPtr endptr);
+static void RemoveXlogFile(const char *segname, XLogRecPtr lastRedoRecPtr, XLogRecPtr endptr);
static void UpdateLastRemovedPtr(char *filename);
static void ValidateXLOGDirectoryStructure(void);
static void CleanupBackupHistory(void);
@@ -2299,7 +2299,7 @@ assign_checkpoint_completion_target(double newval, void *extra)
* XLOG segments? Returns the highest segment that should be preallocated.
*/
static XLogSegNo
-XLOGfileslop(XLogRecPtr RedoRecPtr)
+XLOGfileslop(XLogRecPtr lastRedoRecPtr)
{
XLogSegNo minSegNo;
XLogSegNo maxSegNo;
@@ -2311,9 +2311,9 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
* correspond to. Always recycle enough segments to meet the minimum, and
* remove enough segments to stay below the maximum.
*/
- minSegNo = RedoRecPtr / wal_segment_size +
+ minSegNo = lastRedoRecPtr / wal_segment_size +
ConvertToXSegs(min_wal_size_mb, wal_segment_size) - 1;
- maxSegNo = RedoRecPtr / wal_segment_size +
+ maxSegNo = lastRedoRecPtr / wal_segment_size +
ConvertToXSegs(max_wal_size_mb, wal_segment_size) - 1;
/*
@@ -2328,7 +2328,7 @@ XLOGfileslop(XLogRecPtr RedoRecPtr)
/* add 10% for good measure. */
distance *= 1.10;
- recycleSegNo = (XLogSegNo) ceil(((double) RedoRecPtr + distance) /
+ recycleSegNo = (XLogSegNo) ceil(((double) lastRedoRecPtr + distance) /
wal_segment_size);
if (recycleSegNo < minSegNo)
@@ -3949,12 +3949,12 @@ RemoveTempXlogFiles(void)
/*
* Recycle or remove all log files older or equal to passed segno.
*
- * endptr is current (or recent) end of xlog, and RedoRecPtr is the
+ * endptr is current (or recent) end of xlog, and lastRedoRecPtr is the
* redo pointer of the last checkpoint. These are used to determine
* whether we want to recycle rather than delete no-longer-wanted log files.
*/
static void
-RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
+RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr lastRedoRecPtr, XLogRecPtr endptr)
{
DIR *xldir;
struct dirent *xlde;
@@ -3997,7 +3997,7 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
/* Update the last removed location in shared memory first */
UpdateLastRemovedPtr(xlde->d_name);
- RemoveXlogFile(xlde->d_name, RedoRecPtr, endptr);
+ RemoveXlogFile(xlde->d_name, lastRedoRecPtr, endptr);
}
}
}
@@ -4071,14 +4071,14 @@ RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI)
/*
* Recycle or remove a log file that's no longer needed.
*
- * endptr is current (or recent) end of xlog, and RedoRecPtr is the
+ * endptr is current (or recent) end of xlog, and lastRedoRecPtr is the
* redo pointer of the last checkpoint. These are used to determine
* whether we want to recycle rather than delete no-longer-wanted log files.
- * If RedoRecPtr is not known, pass invalid, and the function will recycle,
+ * If lastRedoRecPtr is not known, pass invalid, and the function will recycle,
* somewhat arbitrarily, 10 future segments.
*/
static void
-RemoveXlogFile(const char *segname, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
+RemoveXlogFile(const char *segname, XLogRecPtr lastRedoRecPtr, XLogRecPtr endptr)
{
char path[MAXPGPATH];
#ifdef WIN32
@@ -4094,10 +4094,10 @@ RemoveXlogFile(const char *segname, XLogRecPtr RedoRecPtr, XLogRecPtr endptr)
* Initialize info about where to try to recycle to.
*/
XLByteToSeg(endptr, endlogSegNo, wal_segment_size);
- if (RedoRecPtr == InvalidXLogRecPtr)
+ if (lastRedoRecPtr == InvalidXLogRecPtr)
recycleSegNo = endlogSegNo + 10;
else
- recycleSegNo = XLOGfileslop(RedoRecPtr);
+ recycleSegNo = XLOGfileslop(lastRedoRecPtr);
}
else
recycleSegNo = 0; /* keep compiler quiet */
@@ -7158,11 +7158,11 @@ StartupXLOG(void)
if (info == XLOG_CHECKPOINT_SHUTDOWN)
{
- CheckPoint checkPoint;
+ CheckPoint xcheckPoint;
- memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
- newTLI = checkPoint.ThisTimeLineID;
- prevTLI = checkPoint.PrevTimeLineID;
+ memcpy(&xcheckPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
+ newTLI = xcheckPoint.ThisTimeLineID;
+ prevTLI = xcheckPoint.PrevTimeLineID;
}
else if (info == XLOG_END_OF_RECOVERY)
{
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 67418b05f1..bc8156fcd6 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -70,7 +70,7 @@ report_invalid_record(XLogReaderState *state, const char *fmt,...)
* Returns NULL if the xlogreader couldn't be allocated.
*/
XLogReaderState *
-XLogReaderAllocate(int wal_segment_size, const char *waldir,
+XLogReaderAllocate(int wallog_segment_size, const char *waldir,
XLogPageReadCB pagereadfunc, void *private_data)
{
XLogReaderState *state;
@@ -99,7 +99,7 @@ XLogReaderAllocate(int wal_segment_size, const char *waldir,
}
/* Initialize segment info. */
- WALOpenSegmentInit(&state->seg, &state->segcxt, wal_segment_size,
+ WALOpenSegmentInit(&state->seg, &state->segcxt, wallog_segment_size,
waldir);
state->read_page = pagereadfunc;
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 5408edcfc2..2f17c140c2 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -57,7 +57,7 @@ static void
parse_subscription_options(List *options, bool *connect, bool *enabled_given,
bool *enabled, bool *create_slot,
bool *slot_name_given, char **slot_name,
- bool *copy_data, char **synchronous_commit,
+ bool *copy_data, char **synchr_commit,
bool *refresh)
{
ListCell *lc;
@@ -85,8 +85,8 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
}
if (copy_data)
*copy_data = true;
- if (synchronous_commit)
- *synchronous_commit = NULL;
+ if (synchr_commit)
+ *synchr_commit = NULL;
if (refresh)
*refresh = true;
@@ -150,17 +150,17 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
*copy_data = defGetBoolean(defel);
}
else if (strcmp(defel->defname, "synchronous_commit") == 0 &&
- synchronous_commit)
+ synchr_commit)
{
- if (*synchronous_commit)
+ if (*synchr_commit)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
- *synchronous_commit = defGetString(defel);
+ *synchr_commit = defGetString(defel);
/* Test if the given value is valid for synchronous_commit GUC. */
- (void) set_config_option("synchronous_commit", *synchronous_commit,
+ (void) set_config_option("synchronous_commit", *synchr_commit,
PGC_BACKEND, PGC_S_TEST, GUC_ACTION_SET,
false, 0, false);
}
@@ -317,7 +317,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
bool enabled_given;
bool enabled;
bool copy_data;
- char *synchronous_commit;
+ char *synchr_commit;
char *conninfo;
char *slotname;
bool slotname_given;
@@ -332,7 +332,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
*/
parse_subscription_options(stmt->options, &connect, &enabled_given,
&enabled, &create_slot, &slotname_given,
- &slotname, ©_data, &synchronous_commit,
+ &slotname, ©_data, &synchr_commit,
NULL);
/*
@@ -375,8 +375,8 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
slotname = stmt->subname;
/* The default for synchronous_commit of subscriptions is off. */
- if (synchronous_commit == NULL)
- synchronous_commit = "off";
+ if (synchr_commit == NULL)
+ synchr_commit = "off";
conninfo = stmt->conninfo;
publications = stmt->publication;
@@ -407,7 +407,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
else
nulls[Anum_pg_subscription_subslotname - 1] = true;
values[Anum_pg_subscription_subsynccommit - 1] =
- CStringGetTextDatum(synchronous_commit);
+ CStringGetTextDatum(synchr_commit);
values[Anum_pg_subscription_subpublications - 1] =
publicationListToArray(publications);
@@ -430,14 +430,14 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
{
XLogRecPtr lsn;
char *err;
- WalReceiverConn *wrconn;
+ WalReceiverConn *walrconn;
List *tables;
ListCell *lc;
char table_state;
/* Try to connect to the publisher. */
- wrconn = walrcv_connect(conninfo, true, stmt->subname, &err);
- if (!wrconn)
+ walrconn = walrcv_connect(conninfo, true, stmt->subname, &err);
+ if (!walrconn)
ereport(ERROR,
(errmsg("could not connect to the publisher: %s", err)));
@@ -668,11 +668,11 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
{
char *slotname;
bool slotname_given;
- char *synchronous_commit;
+ char *synchr_commit;
parse_subscription_options(stmt->options, NULL, NULL, NULL,
NULL, &slotname_given, &slotname,
- NULL, &synchronous_commit, NULL);
+ NULL, &synchr_commit, NULL);
if (slotname_given)
{
@@ -690,10 +690,10 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
replaces[Anum_pg_subscription_subslotname - 1] = true;
}
- if (synchronous_commit)
+ if (synchr_commit)
{
values[Anum_pg_subscription_subsynccommit - 1] =
- CStringGetTextDatum(synchronous_commit);
+ CStringGetTextDatum(synchr_commit);
replaces[Anum_pg_subscription_subsynccommit - 1] = true;
}
@@ -835,7 +835,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
char originname[NAMEDATALEN];
char *err = NULL;
RepOriginId originid;
- WalReceiverConn *wrconn = NULL;
+ WalReceiverConn *walrconn = NULL;
StringInfoData cmd;
Form_pg_subscription form;
@@ -982,8 +982,8 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
initStringInfo(&cmd);
appendStringInfo(&cmd, "DROP_REPLICATION_SLOT %s WAIT", quote_identifier(slotname));
- wrconn = walrcv_connect(conninfo, true, subname, &err);
- if (wrconn == NULL)
+ walrconn = walrcv_connect(conninfo, true, subname, &err);
+ if (walrconn == NULL)
ereport(ERROR,
(errmsg("could not connect to publisher when attempting to "
"drop the replication slot \"%s\"", slotname),
@@ -996,7 +996,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
{
WalRcvExecResult *res;
- res = walrcv_exec(wrconn, cmd.data, 0, NULL);
+ res = walrcv_exec(walrconn, cmd.data, 0, NULL);
if (res->status != WALRCV_OK_COMMAND)
ereport(ERROR,
@@ -1012,7 +1012,7 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
}
PG_FINALLY();
{
- walrcv_disconnect(wrconn);
+ walrcv_disconnect(walrconn);
}
PG_END_TRY();
@@ -1124,7 +1124,7 @@ AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId)
* publisher connection.
*/
static List *
-fetch_table_list(WalReceiverConn *wrconn, List *publications)
+fetch_table_list(WalReceiverConn *walrconn, List *publications)
{
WalRcvExecResult *res;
StringInfoData cmd;
@@ -1154,7 +1154,7 @@ fetch_table_list(WalReceiverConn *wrconn, List *publications)
}
appendStringInfoChar(&cmd, ')');
- res = walrcv_exec(wrconn, cmd.data, 2, tableRow);
+ res = walrcv_exec(walrconn, cmd.data, 2, tableRow);
pfree(cmd.data);
if (res->status != WALRCV_OK_TUPLES)
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index a9edbfd4a4..1f5921b6e7 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -225,7 +225,7 @@ main(int argc, char *argv[])
* without help. Avoid adding more here, if you can.
*/
static void
-startup_hacks(const char *progname)
+startup_hacks(const char *prog_name)
{
/*
* Windows-specific execution environment hacking.
@@ -244,7 +244,7 @@ startup_hacks(const char *progname)
if (err != 0)
{
write_stderr("%s: WSAStartup failed: %d\n",
- progname, err);
+ prog_name, err);
exit(1);
}
@@ -305,10 +305,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 *prog_name)
{
- 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"), prog_name);
+ printf(_("Usage:\n %s [OPTION]...\n\n"), prog_name);
printf(_("Options:\n"));
printf(_(" -B NBUFFERS number of shared buffers\n"));
printf(_(" -c NAME=VALUE set run-time parameter\n"));
@@ -365,7 +365,7 @@ help(const char *progname)
static void
-check_root(const char *progname)
+check_root(const char *prog_name)
{
#ifndef WIN32
if (geteuid() == 0)
@@ -388,7 +388,7 @@ check_root(const char *progname)
if (getuid() != geteuid())
{
write_stderr("%s: real and effective user IDs must match\n",
- progname);
+ prog_name);
exit(1);
}
#else /* WIN32 */
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 9ff2832c00..29a3a7517d 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2538,7 +2538,7 @@ ConnFree(Port *conn)
* the global variable yet when this is called.
*/
void
-ClosePostmasterPorts(bool am_syslogger)
+ClosePostmasterPorts(bool syslogger)
{
int i;
@@ -2567,7 +2567,7 @@ ClosePostmasterPorts(bool am_syslogger)
}
/* If using syslogger, close the read side of the pipe */
- if (!am_syslogger)
+ if (!syslogger)
{
#ifndef WIN32
if (syslogPipe[0] >= 0)
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 8b2a2be1c0..e12f41cea4 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -3223,7 +3223,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
for (i = 0; i < max_wal_senders; i++)
{
WalSnd *walsnd = &WalSndCtl->walsnds[i];
- XLogRecPtr sentPtr;
+ XLogRecPtr walsentPtr;
XLogRecPtr write;
XLogRecPtr flush;
XLogRecPtr apply;
@@ -3247,7 +3247,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
continue;
}
pid = walsnd->pid;
- sentPtr = walsnd->sentPtr;
+ walsentPtr = walsnd->sentPtr;
state = walsnd->state;
write = walsnd->write;
flush = walsnd->flush;
@@ -3278,9 +3278,9 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
{
values[1] = CStringGetTextDatum(WalSndGetStateString(state));
- if (XLogRecPtrIsInvalid(sentPtr))
+ if (XLogRecPtrIsInvalid(walsentPtr))
nulls[2] = true;
- values[2] = LSNGetDatum(sentPtr);
+ values[2] = LSNGetDatum(walsentPtr);
if (XLogRecPtrIsInvalid(write))
nulls[3] = true;
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 709bbaaf5a..63097739c4 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -508,16 +508,16 @@ Datum
date_pli(PG_FUNCTION_ARGS)
{
DateADT dateVal = PG_GETARG_DATEADT(0);
- int32 days = PG_GETARG_INT32(1);
+ int32 ndays = PG_GETARG_INT32(1);
DateADT result;
if (DATE_NOT_FINITE(dateVal))
PG_RETURN_DATEADT(dateVal); /* can't change infinity */
- result = dateVal + days;
+ result = dateVal + ndays;
/* Check for integer overflow and out-of-allowed-range */
- if ((days >= 0 ? (result < dateVal) : (result > dateVal)) ||
+ if ((ndays >= 0 ? (result < dateVal) : (result > dateVal)) ||
!IS_VALID_DATE(result))
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
@@ -532,16 +532,16 @@ Datum
date_mii(PG_FUNCTION_ARGS)
{
DateADT dateVal = PG_GETARG_DATEADT(0);
- int32 days = PG_GETARG_INT32(1);
+ int32 ndays = PG_GETARG_INT32(1);
DateADT result;
if (DATE_NOT_FINITE(dateVal))
PG_RETURN_DATEADT(dateVal); /* can't change infinity */
- result = dateVal - days;
+ result = dateVal - ndays;
/* Check for integer overflow and out-of-allowed-range */
- if ((days >= 0 ? (result > dateVal) : (result < dateVal)) ||
+ if ((ndays >= 0 ? (result > dateVal) : (result < dateVal)) ||
!IS_VALID_DATE(result))
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
@@ -1810,18 +1810,18 @@ interval_time(PG_FUNCTION_ARGS)
{
Interval *span = PG_GETARG_INTERVAL_P(0);
TimeADT result;
- int64 days;
+ int64 ndays;
result = span->time;
if (result >= USECS_PER_DAY)
{
- days = result / USECS_PER_DAY;
- result -= days * USECS_PER_DAY;
+ ndays = result / USECS_PER_DAY;
+ result -= ndays * USECS_PER_DAY;
}
else if (result < 0)
{
- days = (-result + USECS_PER_DAY - 1) / USECS_PER_DAY;
- result += days * USECS_PER_DAY;
+ ndays = (-result + USECS_PER_DAY - 1) / USECS_PER_DAY;
+ result += ndays * USECS_PER_DAY;
}
PG_RETURN_TIMEADT(result);
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 31bdb37c55..2f721ee67e 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -1500,9 +1500,9 @@ Datum
make_interval(PG_FUNCTION_ARGS)
{
int32 years = PG_GETARG_INT32(0);
- int32 months = PG_GETARG_INT32(1);
+ int32 nmonths = PG_GETARG_INT32(1);
int32 weeks = PG_GETARG_INT32(2);
- int32 days = PG_GETARG_INT32(3);
+ int32 ndays = PG_GETARG_INT32(3);
int32 hours = PG_GETARG_INT32(4);
int32 mins = PG_GETARG_INT32(5);
double secs = PG_GETARG_FLOAT8(6);
@@ -1518,8 +1518,8 @@ make_interval(PG_FUNCTION_ARGS)
errmsg("interval out of range")));
result = (Interval *) palloc(sizeof(Interval));
- result->month = years * MONTHS_PER_YEAR + months;
- result->day = weeks * 7 + days;
+ result->month = years * MONTHS_PER_YEAR + nmonths;
+ result->day = weeks * 7 + ndays;
secs = rint(secs * USECS_PER_SEC);
result->time = hours * ((int64) SECS_PER_HOUR * USECS_PER_SEC) +
@@ -2343,22 +2343,22 @@ interval_cmp_value(const Interval *interval)
{
INT128 span;
int64 dayfraction;
- int64 days;
+ int64 ndays;
/*
* Separate time field into days and dayfraction, then add the month and
* day fields to the days part. We cannot overflow int64 days here.
*/
dayfraction = interval->time % USECS_PER_DAY;
- days = interval->time / USECS_PER_DAY;
- days += interval->month * INT64CONST(30);
- days += interval->day;
+ ndays = interval->time / USECS_PER_DAY;
+ ndays += interval->month * INT64CONST(30);
+ ndays += interval->day;
/* Widen dayfraction to 128 bits */
span = int64_to_int128(dayfraction);
/* Scale up days to microseconds, forming a 128-bit product */
- int128_add_int64_mul_int64(&span, days, USECS_PER_DAY);
+ int128_add_int64_mul_int64(&span, ndays, USECS_PER_DAY);
return span;
}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index ba74bf9f7d..1644c66236 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -5389,7 +5389,7 @@ InitializeOneGUCOption(struct config_generic *gconf)
* to stderr and returns false.
*/
bool
-SelectConfigFiles(const char *userDoption, const char *progname)
+SelectConfigFiles(const char *userDoption, const char *prog_name)
{
char *configdir;
char *fname;
@@ -5404,7 +5404,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
if (configdir && stat(configdir, &stat_buf) != 0)
{
write_stderr("%s: could not access directory \"%s\": %s\n",
- progname,
+ prog_name,
configdir,
strerror(errno));
if (errno == ENOENT)
@@ -5431,7 +5431,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
write_stderr("%s does not know where to find the server configuration file.\n"
"You must specify the --config-file or -D invocation "
"option or set the PGDATA environment variable.\n",
- progname);
+ prog_name);
return false;
}
@@ -5448,7 +5448,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
if (stat(ConfigFileName, &stat_buf) != 0)
{
write_stderr("%s: could not access the server configuration file \"%s\": %s\n",
- progname, ConfigFileName, strerror(errno));
+ prog_name, ConfigFileName, strerror(errno));
free(configdir);
return false;
}
@@ -5477,7 +5477,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
"This can be specified as \"data_directory\" in \"%s\", "
"or by the -D invocation option, or by the "
"PGDATA environment variable.\n",
- progname, ConfigFileName);
+ prog_name, ConfigFileName);
return false;
}
@@ -5525,7 +5525,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
"This can be specified as \"hba_file\" in \"%s\", "
"or by the -D invocation option, or by the "
"PGDATA environment variable.\n",
- progname, ConfigFileName);
+ prog_name, ConfigFileName);
return false;
}
SetConfigOption("hba_file", fname, PGC_POSTMASTER, PGC_S_OVERRIDE);
@@ -5548,7 +5548,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
"This can be specified as \"ident_file\" in \"%s\", "
"or by the -D invocation option, or by the "
"PGDATA environment variable.\n",
- progname, ConfigFileName);
+ prog_name, ConfigFileName);
return false;
}
SetConfigOption("ident_file", fname, PGC_POSTMASTER, PGC_S_OVERRIDE);
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 1f6d8939be..88ed6ff44b 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -266,10 +266,10 @@ static void trapsig(int signum);
static void check_ok(void);
static char *escape_quotes(const char *src);
static char *escape_quotes_bki(const char *src);
-static int locale_date_order(const char *locale);
-static void check_locale_name(int category, const char *locale,
+static int locale_date_order(const char *locale_name);
+static void check_locale_name(int category, const char *locale_name,
char **canonname);
-static bool check_locale_encoding(const char *locale, int encoding);
+static bool check_locale_encoding(const char *locale_name, int encoding);
static void setlocales(void);
static void usage(const char *progname);
void setup_pgdata(void);
@@ -631,7 +631,7 @@ cleanup_directories_atexit(void)
static char *
get_id(void)
{
- const char *username;
+ const char *user_name;
#ifndef WIN32
if (geteuid() == 0) /* 0 is root's uid */
@@ -644,9 +644,9 @@ get_id(void)
}
#endif
- username = get_user_name_or_exit(progname);
+ user_name = get_user_name_or_exit(progname);
- return pg_strdup(username);
+ return pg_strdup(user_name);
}
static char *
@@ -864,17 +864,17 @@ 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_log_error("could not open file \"%s\" for writing: %m", path);
exit(1);
}
- if (fclose(conf_file))
+ if (fclose(file))
{
pg_log_error("could not write file \"%s\": %m", path);
exit(1);
@@ -2107,7 +2107,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 *locale_name)
{
struct tm testtime;
char buf[128];
@@ -2125,7 +2125,7 @@ locale_date_order(const char *locale)
return result;
save = pg_strdup(save);
- setlocale(LC_TIME, locale);
+ setlocale(LC_TIME, locale_name);
memset(&testtime, 0, sizeof(testtime));
testtime.tm_mday = 22;
@@ -2170,7 +2170,7 @@ 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 *locale_name, char **canonname)
{
char *save;
char *res;
@@ -2193,7 +2193,7 @@ check_locale_name(int category, const char *locale, char **canonname)
locale = "";
/* set the locale with setlocale, to see if it accepts it. */
- res = setlocale(category, locale);
+ res = setlocale(category, locale_name);
/* save canonical name if requested. */
if (res && canonname)
@@ -2210,8 +2210,8 @@ check_locale_name(int category, const char *locale, char **canonname)
/* complain if locale wasn't valid */
if (res == NULL)
{
- if (*locale)
- pg_log_error("invalid locale name \"%s\"", locale);
+ if (*locale_name)
+ pg_log_error("invalid locale name \"%s\"", locale_name);
else
{
/*
@@ -2234,11 +2234,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 *locale_name, int user_enc)
{
int locale_enc;
- locale_enc = pg_get_encoding_from_locale(locale, true);
+ locale_enc = pg_get_encoding_from_locale(locale_name, true);
/* See notes in createdb() to understand these tests */
if (!(locale_enc == user_enc ||
@@ -2321,11 +2321,11 @@ setlocales(void)
* print help text
*/
static void
-usage(const char *progname)
+usage(const char *prog_name)
{
- printf(_("%s initializes a PostgreSQL database cluster.\n\n"), progname);
+ printf(_("%s initializes a PostgreSQL database cluster.\n\n"), prog_name);
printf(_("Usage:\n"));
- printf(_(" %s [OPTION]... [DATADIR]\n"), progname);
+ printf(_(" %s [OPTION]... [DATADIR]\n"), prog_name);
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"));
@@ -2393,22 +2393,22 @@ check_authmethod_valid(const char *authmethod, const char *const *valid_methods,
}
static void
-check_need_password(const char *authmethodlocal, const char *authmethodhost)
+check_need_password(const char *authmethod_local, const char *authmethod_host)
{
- 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) &&
+ if ((strcmp(authmethod_local, "md5") == 0 ||
+ strcmp(authmethod_local, "password") == 0 ||
+ strcmp(authmethod_local, "scram-sha-256") == 0) &&
+ (strcmp(authmethod_host, "md5") == 0 ||
+ strcmp(authmethod_host, "password") == 0 ||
+ strcmp(authmethod_host, "scram-sha-256") == 0) &&
!(pwprompt || pwfilename))
{
pg_log_error("must specify a password for the superuser to enable %s authentication",
- (strcmp(authmethodlocal, "md5") == 0 ||
- strcmp(authmethodlocal, "password") == 0 ||
- strcmp(authmethodlocal, "scram-sha-256") == 0)
- ? authmethodlocal
- : authmethodhost);
+ (strcmp(authmethod_local, "md5") == 0 ||
+ strcmp(authmethod_local, "password") == 0 ||
+ strcmp(authmethod_local, "scram-sha-256") == 0)
+ ? authmethod_local
+ : authmethod_host);
exit(1);
}
}
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index 19e21ab491..11784c589b 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -30,11 +30,11 @@
#include "pg_getopt.h"
static void
-usage(const char *progname)
+usage(const char *prog_name)
{
- printf(_("%s displays control information of a PostgreSQL database cluster.\n\n"), progname);
+ printf(_("%s displays control information of a PostgreSQL database cluster.\n\n"), prog_name);
printf(_("Usage:\n"));
- printf(_(" %s [OPTION] [DATADIR]\n"), progname);
+ printf(_(" %s [OPTION] [DATADIR]\n"), prog_name);
printf(_("\nOptions:\n"));
printf(_(" [-D, --pgdata=]DATADIR data directory\n"));
printf(_(" -V, --version output version information, then exit\n"));
@@ -69,9 +69,9 @@ dbState(DBState state)
}
static const char *
-wal_level_str(WalLevel wal_level)
+wal_level_str(WalLevel wallevel)
{
- switch (wal_level)
+ switch (wallevel)
{
case WAL_LEVEL_MINIMAL:
return "minimal";
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 65f9fb4c0a..80715bae01 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -742,7 +742,7 @@ read_post_opts(void)
* waiting for the server to start up, the server launch is aborted.
*/
static void
-trap_sigint_during_startup(int sig)
+trap_sigint_during_startup(int signal)
{
if (postmasterPID != -1)
{
@@ -760,18 +760,18 @@ trap_sigint_during_startup(int sig)
}
static char *
-find_other_exec_or_die(const char *argv0, const char *target, const char *versionstr)
+find_other_exec_or_die(const char *argv_0, const char *target, const char *versionstr)
{
int ret;
char *found_path;
found_path = pg_malloc(MAXPGPATH);
- if ((ret = find_other_exec(argv0, target, versionstr, found_path)) < 0)
+ if ((ret = find_other_exec(argv_0, target, versionstr, found_path)) < 0)
{
char full_path[MAXPGPATH];
- if (find_my_exec(argv0, full_path) < 0)
+ if (find_my_exec(argv_0, full_path) < 0)
strlcpy(full_path, progname, sizeof(full_path));
if (ret == -1)
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index 37432a6f4b..135b9e13de 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -64,10 +64,10 @@ static int numExtensions;
static ExtensionMemberId *extmembers;
static int numextmembers;
-static void flagInhTables(Archive *fout, TableInfo *tbinfo, int numTables,
+static void flagInhTables(Archive *fout, TableInfo *tbinfo, int num_Tables,
InhInfo *inhinfo, int numInherits);
-static void flagInhIndexes(Archive *fout, TableInfo *tblinfo, int numTables);
-static void flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables);
+static void flagInhIndexes(Archive *fout, TableInfo *tblinfo, int num_Tables);
+static void flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int num_Tables);
static DumpableObject **buildIndexArray(void *objArray, int numObjs,
Size objSize);
static int DOCatalogIdCompare(const void *p1, const void *p2);
@@ -270,14 +270,14 @@ getSchemaData(Archive *fout, int *numTablesPtr)
* modifies tblinfo
*/
static void
-flagInhTables(Archive *fout, TableInfo *tblinfo, int numTables,
+flagInhTables(Archive *fout, TableInfo *tblinfo, int num_Tables,
InhInfo *inhinfo, int numInherits)
{
DumpOptions *dopt = fout->dopt;
int i,
j;
- for (i = 0; i < numTables; i++)
+ for (i = 0; i < num_Tables; i++)
{
bool find_parents = true;
bool mark_parents = true;
@@ -329,7 +329,7 @@ flagInhTables(Archive *fout, TableInfo *tblinfo, int numTables,
* appropriate dependency links.
*/
static void
-flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
+flagInhIndexes(Archive *fout, TableInfo tblinfo[], int num_Tables)
{
int i,
j,
@@ -339,7 +339,7 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
parentIndexArray = (DumpableObject ***)
pg_malloc0(getMaxDumpId() * sizeof(DumpableObject **));
- for (i = 0; i < numTables; i++)
+ for (i = 0; i < num_Tables; i++)
{
TableInfo *parenttbl;
IndexAttachInfo *attachinfo;
@@ -436,13 +436,13 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
* modifies tblinfo
*/
static void
-flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables)
+flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int num_Tables)
{
int i,
j,
k;
- for (i = 0; i < numTables; i++)
+ for (i = 0; i < num_Tables; i++)
{
TableInfo *tbinfo = &(tblinfo[i]);
int numParents;
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 08658c8e86..5cfa243ad4 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -147,7 +147,7 @@ static int extra_float_digits;
fmtQualifiedId((obj)->dobj.namespace->dobj.name, \
(obj)->dobj.name)
-static void help(const char *progname);
+static void help(const char *prog_name);
static void setup_connection(Archive *AH,
const char *dumpencoding, const char *dumpsnapshot,
char *use_role);
@@ -155,11 +155,11 @@ static ArchiveFormat parseArchiveFormat(const char *format, ArchiveMode *mode);
static void expand_schema_name_patterns(Archive *fout,
SimpleStringList *patterns,
SimpleOidList *oids,
- bool strict_names);
+ bool strictnames);
static void expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns,
SimpleOidList *oids,
- bool strict_names);
+ bool strictnames);
static NamespaceInfo *findNamespace(Archive *fout, Oid nsoid);
static void dumpTableData(Archive *fout, TableDataInfo *tdinfo);
static void refreshMatViewData(Archive *fout, TableDataInfo *tdinfo);
@@ -972,11 +972,11 @@ main(int argc, char **argv)
static void
-help(const char *progname)
+help(const char *prog_name)
{
- printf(_("%s dumps a database as a text file or to other formats.\n\n"), progname);
+ printf(_("%s dumps a database as a text file or to other formats.\n\n"), prog_name);
printf(_("Usage:\n"));
- printf(_(" %s [OPTION]... [DBNAME]\n"), progname);
+ printf(_(" %s [OPTION]... [DBNAME]\n"), prog_name);
printf(_("\nGeneral options:\n"));
printf(_(" -f, --file=FILENAME output file or directory name\n"));
@@ -1293,7 +1293,7 @@ static void
expand_schema_name_patterns(Archive *fout,
SimpleStringList *patterns,
SimpleOidList *oids,
- bool strict_names)
+ bool strictnames)
{
PQExpBuffer query;
PGresult *res;
@@ -1318,7 +1318,7 @@ expand_schema_name_patterns(Archive *fout,
false, NULL, "n.nspname", NULL, NULL);
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
- if (strict_names && PQntuples(res) == 0)
+ if (strictnames && PQntuples(res) == 0)
fatal("no matching schemas were found for pattern \"%s\"", cell->val);
for (i = 0; i < PQntuples(res); i++)
@@ -1341,7 +1341,7 @@ expand_schema_name_patterns(Archive *fout,
static void
expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns, SimpleOidList *oids,
- bool strict_names)
+ bool strictnames)
{
PQExpBuffer query;
PGresult *res;
@@ -1383,7 +1383,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 (strictnames && PQntuples(res) == 0)
fatal("no matching tables were found for pattern \"%s\"", cell->val);
for (i = 0; i < PQntuples(res); i++)
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index d1a36b1495..67fa5e8975 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -50,7 +50,7 @@
#include "parallel.h"
#include "pg_backup_utils.h"
-static void usage(const char *progname);
+static void usage(const char *prog_name);
int
main(int argc, char **argv)
@@ -456,11 +456,11 @@ main(int argc, char **argv)
}
static void
-usage(const char *progname)
+usage(const char *prog_name)
{
- 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"), prog_name);
printf(_("Usage:\n"));
- printf(_(" %s [OPTION]... [FILE]\n"), progname);
+ printf(_(" %s [OPTION]... [FILE]\n"), prog_name);
printf(_("\nGeneral options:\n"));
printf(_(" -d, --dbname=NAME connect to database name\n"));
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 2e286f6339..7fb590ffb8 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -738,9 +738,9 @@ GuessControlValues(void)
* reset by RewriteControlFile().
*/
static void
-PrintControlValues(bool guessed)
+PrintControlValues(bool guessed_control)
{
- if (guessed)
+ if (guessed_control)
printf(_("Guessed pg_control values:\n\n"));
else
printf(_("Current pg_control values:\n\n"));
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index 2ca1608bd2..0023c67938 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -91,7 +91,7 @@ static void signal_cleanup(int sig);
#ifdef HAVE_FSYNC_WRITETHROUGH
static int pg_fsync_writethrough(int fd);
#endif
-static void print_elapse(struct timeval start_t, struct timeval stop_t, int ops);
+static void print_elapse(struct timeval startt, struct timeval stopt, int ops);
#define die(msg) do { pg_log_error("%s: %m", _(msg)); exit(1); } while(0)
@@ -576,10 +576,10 @@ pg_fsync_writethrough(int fd)
* print out the writes per second for tests
*/
static void
-print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
+print_elapse(struct timeval startt, struct timeval stopt, int ops)
{
- double total_time = (stop_t.tv_sec - start_t.tv_sec) +
- (stop_t.tv_usec - start_t.tv_usec) * 0.000001;
+ double total_time = (stopt.tv_sec - startt.tv_sec) +
+ (stopt.tv_usec - startt.tv_usec) * 0.000001;
double per_second = ops / total_time;
double avg_op_time_us = (total_time / ops) * USECS_SEC;
diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h
index 0193611b7f..d8991d1a79 100644
--- a/src/include/access/xlogreader.h
+++ b/src/include/access/xlogreader.h
@@ -209,7 +209,7 @@ struct XLogReaderState
};
/* Get a new XLogReader */
-extern XLogReaderState *XLogReaderAllocate(int wal_segment_size,
+extern XLogReaderState *XLogReaderAllocate(int wallog_segment_size,
const char *waldir,
XLogPageReadCB pagereadfunc,
void *private_data);
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index 50098e63fe..809f043ba1 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -354,7 +354,7 @@ extern const char *GetConfigOptionResetString(const char *name);
extern int GetConfigOptionFlags(const char *name, bool missing_ok);
extern void ProcessConfigFile(GucContext context);
extern void InitializeGUCOptions(void);
-extern bool SelectConfigFiles(const char *userDoption, const char *progname);
+extern bool SelectConfigFiles(const char *userDoption, const char *prog_name);
extern void ResetAllOptions(void);
extern void AtStart_GUC(void);
extern int NewGUCNestLevel(void);
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c
index a29f530327..7568d1c1a9 100644
--- a/src/interfaces/ecpg/preproc/descriptor.c
+++ b/src/interfaces/ecpg/preproc/descriptor.c
@@ -73,7 +73,7 @@ ECPGnumeric_lvalue(char *name)
static struct descriptor *descriptors;
void
-add_descriptor(char *name, char *connection)
+add_descriptor(char *name, char *conn_str)
{
struct descriptor *new;
@@ -87,16 +87,16 @@ add_descriptor(char *name, char *connection)
strcpy(new->name, name);
if (connection)
{
- new->connection = mm_alloc(strlen(connection) + 1);
- strcpy(new->connection, connection);
+ new->connection = mm_alloc(strlen(conn_str) + 1);
+ strcpy(new->connection, conn_str);
}
else
- new->connection = connection;
+ new->connection = conn_str;
descriptors = new;
}
void
-drop_descriptor(char *name, char *connection)
+drop_descriptor(char *name, char *conn_str)
{
struct descriptor *i;
struct descriptor **lastptr = &descriptors;
@@ -108,9 +108,9 @@ drop_descriptor(char *name, char *connection)
{
if (strcmp(name, i->name) == 0)
{
- if ((!connection && !i->connection)
- || (connection && i->connection
- && strcmp(connection, i->connection) == 0))
+ if ((!conn_str && !i->connection)
+ || (conn_str && i->connection
+ && strcmp(conn_str, i->connection) == 0))
{
*lastptr = i->next;
if (i->connection)
@@ -126,7 +126,7 @@ drop_descriptor(char *name, char *connection)
struct descriptor
*
-lookup_descriptor(char *name, char *connection)
+lookup_descriptor(char *name, char *conn_str)
{
struct descriptor *i;
@@ -137,9 +137,9 @@ lookup_descriptor(char *name, char *connection)
{
if (strcmp(name, i->name) == 0)
{
- if ((!connection && !i->connection)
- || (connection && i->connection
- && strcmp(connection, i->connection) == 0))
+ if ((!conn_str && !i->connection)
+ || (conn_str && i->connection
+ && strcmp(conn_str, i->connection) == 0))
return i;
}
}