1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-09 13:09:39 +03:00

Rename shadowed local variables

In a similar effort to f01592f91, here we mostly rename shadowed local
variables to remove the warnings produced when compiling with
-Wshadow=compatible-local.

This fixes 63 warnings and leaves just 5.

Author: Justin Pryzby, David Rowley
Reviewed-by: Justin Pryzby
Discussion https://postgr.es/m/20220817145434.GC26426%40telsasoft.com
This commit is contained in:
David Rowley
2022-10-05 21:01:41 +13:00
parent 839c2520a7
commit 2d0bbedda7
39 changed files with 220 additions and 226 deletions

View File

@@ -367,10 +367,10 @@ ecpg_store_result(const PGresult *results, int act_field,
/* check strlen for each tuple */
for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
{
int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
int slen = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
if (len > var->varcharsize)
var->varcharsize = len;
if (slen > var->varcharsize)
var->varcharsize = slen;
}
var->offset *= var->varcharsize;
len = var->offset * ntuples;

View File

@@ -558,7 +558,7 @@ ECPGset_var(int number, void *pointer, int lineno)
ptr = (struct var_list *) calloc(1L, sizeof(struct var_list));
if (!ptr)
{
struct sqlca_t *sqlca = ECPGget_sqlca();
sqlca = ECPGget_sqlca();
if (sqlca == NULL)
{

View File

@@ -1820,16 +1820,16 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (ptype == DTK_JULIAN)
{
char *cp;
int val;
int jday;
if (tzp == NULL)
return -1;
val = strtoint(field[i], &cp, 10);
jday = strtoint(field[i], &cp, 10);
if (*cp != '-')
return -1;
j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
j2date(jday, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
/* Get the time zone from the end of the string */
if (DecodeTimezone(cp, tzp) != 0)
return -1;
@@ -1958,9 +1958,9 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (ptype != 0)
{
char *cp;
int val;
int value;
val = strtoint(field[i], &cp, 10);
value = strtoint(field[i], &cp, 10);
/*
* only a few kinds are allowed to have an embedded
@@ -1983,7 +1983,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
switch (ptype)
{
case DTK_YEAR:
tm->tm_year = val;
tm->tm_year = value;
tmask = DTK_M(YEAR);
break;
@@ -1996,33 +1996,33 @@ DecodeDateTime(char **field, int *ftype, int nf,
if ((fmask & DTK_M(MONTH)) != 0 &&
(fmask & DTK_M(HOUR)) != 0)
{
tm->tm_min = val;
tm->tm_min = value;
tmask = DTK_M(MINUTE);
}
else
{
tm->tm_mon = val;
tm->tm_mon = value;
tmask = DTK_M(MONTH);
}
break;
case DTK_DAY:
tm->tm_mday = val;
tm->tm_mday = value;
tmask = DTK_M(DAY);
break;
case DTK_HOUR:
tm->tm_hour = val;
tm->tm_hour = value;
tmask = DTK_M(HOUR);
break;
case DTK_MINUTE:
tm->tm_min = val;
tm->tm_min = value;
tmask = DTK_M(MINUTE);
break;
case DTK_SECOND:
tm->tm_sec = val;
tm->tm_sec = value;
tmask = DTK_M(SECOND);
if (*cp == '.')
{
@@ -2046,7 +2046,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
* previous field was a label for "julian date"?
***/
tmask = DTK_DATE_M;
j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
j2date(value, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
/* fractional Julian Day? */
if (*cp == '.')
{