mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/inet_net_ntop.c,v 1.19 2005/02/01 00:59:09 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/inet_net_ntop.c,v 1.20 2005/09/24 22:54:38 tgl Exp $
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
@@ -443,6 +443,8 @@ inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
|
||||
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
|
||||
best.base = -1;
|
||||
cur.base = -1;
|
||||
best.len = 0;
|
||||
cur.len = 0;
|
||||
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
|
||||
{
|
||||
if (words[i] == 0)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.142 2005/07/23 14:25:33 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.143 2005/09/24 22:54:38 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -79,9 +79,9 @@
|
||||
|
||||
static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz);
|
||||
static void reltime2tm(RelativeTime time, struct pg_tm *tm);
|
||||
static int istinterval(char *i_string,
|
||||
AbsoluteTime *i_start,
|
||||
AbsoluteTime *i_end);
|
||||
static void parsetinterval(char *i_string,
|
||||
AbsoluteTime *i_start,
|
||||
AbsoluteTime *i_end);
|
||||
|
||||
|
||||
/*
|
||||
@@ -727,24 +727,19 @@ tintervalin(PG_FUNCTION_ARGS)
|
||||
t1,
|
||||
t2;
|
||||
|
||||
parsetinterval(tintervalstr, &t1, &t2);
|
||||
|
||||
tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
|
||||
|
||||
if (istinterval(tintervalstr, &t1, &t2) == 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||
errmsg("invalid input syntax for type tinterval: \"%s\"",
|
||||
tintervalstr)));
|
||||
|
||||
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
|
||||
tinterval ->status = T_INTERVAL_INVAL; /* undefined */
|
||||
|
||||
tinterval->status = T_INTERVAL_INVAL; /* undefined */
|
||||
else
|
||||
tinterval ->status = T_INTERVAL_VALID;
|
||||
tinterval->status = T_INTERVAL_VALID;
|
||||
|
||||
i_start = ABSTIMEMIN(t1, t2);
|
||||
i_end = ABSTIMEMAX(t1, t2);
|
||||
tinterval ->data[0] = i_start;
|
||||
tinterval ->data[1] = i_end;
|
||||
tinterval->data[0] = i_start;
|
||||
tinterval->data[1] = i_end;
|
||||
|
||||
PG_RETURN_TIMEINTERVAL(tinterval);
|
||||
}
|
||||
@@ -1444,11 +1439,9 @@ tintervalend(PG_FUNCTION_ARGS)
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* istinterval - returns 1, iff i_string is a valid tinterval descr.
|
||||
* 0, iff i_string is NOT a valid tinterval desc.
|
||||
* 2, iff any time is INVALID_ABSTIME
|
||||
* parsetinterval -- parse a tinterval string
|
||||
*
|
||||
* output parameter:
|
||||
* output parameters:
|
||||
* i_start, i_end: tinterval margins
|
||||
*
|
||||
* Time interval:
|
||||
@@ -1460,10 +1453,10 @@ tintervalend(PG_FUNCTION_ARGS)
|
||||
*
|
||||
* e.g. [ ' Jan 18 1902' 'Jan 1 00:00:00 1970']
|
||||
*/
|
||||
static int
|
||||
istinterval(char *i_string,
|
||||
AbsoluteTime *i_start,
|
||||
AbsoluteTime *i_end)
|
||||
static void
|
||||
parsetinterval(char *i_string,
|
||||
AbsoluteTime *i_start,
|
||||
AbsoluteTime *i_end)
|
||||
{
|
||||
char *p,
|
||||
*p1;
|
||||
@@ -1476,10 +1469,12 @@ istinterval(char *i_string,
|
||||
if (IsSpace(c))
|
||||
p++;
|
||||
else if (c != '[')
|
||||
return 0; /* syntax error */
|
||||
goto bogus; /* syntax error */
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (c == '\0')
|
||||
goto bogus; /* syntax error */
|
||||
p++;
|
||||
/* skip leading blanks up to '"' */
|
||||
while ((c = *p) != '\0')
|
||||
@@ -1487,30 +1482,32 @@ istinterval(char *i_string,
|
||||
if (IsSpace(c))
|
||||
p++;
|
||||
else if (c != '"')
|
||||
return 0; /* syntax error */
|
||||
goto bogus; /* syntax error */
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (c == '\0')
|
||||
goto bogus; /* syntax error */
|
||||
p++;
|
||||
if (strncmp(INVALID_INTERVAL_STR, p, strlen(INVALID_INTERVAL_STR)) == 0)
|
||||
return 0; /* undefined range, handled like a syntax
|
||||
goto bogus; /* undefined range, handled like a syntax
|
||||
* err. */
|
||||
/* search for the end of the first date and change it to a NULL */
|
||||
/* search for the end of the first date and change it to a \0 */
|
||||
p1 = p;
|
||||
while ((c = *p1) != '\0')
|
||||
{
|
||||
if (c == '"')
|
||||
{
|
||||
*p1 = '\0';
|
||||
break;
|
||||
}
|
||||
p1++;
|
||||
}
|
||||
if (c == '\0')
|
||||
goto bogus; /* syntax error */
|
||||
*p1 = '\0';
|
||||
/* get the first date */
|
||||
*i_start = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
|
||||
CStringGetDatum(p)));
|
||||
/* rechange NULL at the end of the first date to a '"' */
|
||||
*p1 = '"';
|
||||
/* undo change to \0 */
|
||||
*p1 = c;
|
||||
p = ++p1;
|
||||
/* skip blanks up to '"', beginning of second date */
|
||||
while ((c = *p) != '\0')
|
||||
@@ -1518,27 +1515,29 @@ istinterval(char *i_string,
|
||||
if (IsSpace(c))
|
||||
p++;
|
||||
else if (c != '"')
|
||||
return 0; /* syntax error */
|
||||
goto bogus; /* syntax error */
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (c == '\0')
|
||||
goto bogus; /* syntax error */
|
||||
p++;
|
||||
/* search for the end of the second date and change it to a NULL */
|
||||
/* search for the end of the second date and change it to a \0 */
|
||||
p1 = p;
|
||||
while ((c = *p1) != '\0')
|
||||
{
|
||||
if (c == '"')
|
||||
{
|
||||
*p1 = '\0';
|
||||
break;
|
||||
}
|
||||
p1++;
|
||||
}
|
||||
if (c == '\0')
|
||||
goto bogus; /* syntax error */
|
||||
*p1 = '\0';
|
||||
/* get the second date */
|
||||
*i_end = DatumGetAbsoluteTime(DirectFunctionCall1(abstimein,
|
||||
CStringGetDatum(p)));
|
||||
/* rechange NULL at the end of the first date to a '"' */
|
||||
*p1 = '"';
|
||||
/* undo change to \0 */
|
||||
*p1 = c;
|
||||
p = ++p1;
|
||||
/* skip blanks up to ']' */
|
||||
while ((c = *p) != '\0')
|
||||
@@ -1546,16 +1545,26 @@ istinterval(char *i_string,
|
||||
if (IsSpace(c))
|
||||
p++;
|
||||
else if (c != ']')
|
||||
return 0; /* syntax error */
|
||||
goto bogus; /* syntax error */
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (c == '\0')
|
||||
goto bogus; /* syntax error */
|
||||
p++;
|
||||
c = *p;
|
||||
if (c != '\0')
|
||||
return 0; /* syntax error */
|
||||
goto bogus; /* syntax error */
|
||||
|
||||
/* it seems to be a valid tinterval */
|
||||
return 1;
|
||||
return;
|
||||
|
||||
bogus:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||
errmsg("invalid input syntax for type tinterval: \"%s\"",
|
||||
i_string)));
|
||||
*i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.188 2005/09/24 17:53:16 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.189 2005/09/24 22:54:38 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -2403,6 +2403,7 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
|
||||
return true;
|
||||
}
|
||||
/* Don't know how to convert */
|
||||
*scaledvalue = *scaledlobound = *scaledhibound = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
4
src/backend/utils/cache/catcache.c
vendored
4
src/backend/utils/cache/catcache.c
vendored
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.123 2005/08/13 22:18:07 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.124 2005/09/24 22:54:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -161,6 +161,8 @@ GetCCHashEqFuncs(Oid keytype, PGFunction *hashfunc, RegProcedure *eqfunc)
|
||||
break;
|
||||
default:
|
||||
elog(FATAL, "type %u not supported as catcache key", keytype);
|
||||
*hashfunc = NULL; /* keep compiler quiet */
|
||||
*eqfunc = InvalidOid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.288 2005/09/12 02:26:32 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.289 2005/09/24 22:54:39 tgl Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@@ -3401,7 +3401,11 @@ parse_bool(const char *value, bool *result)
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (result)
|
||||
*result = false; /* suppress compiler warning */
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3427,7 +3431,11 @@ parse_int(const char *value, int *result)
|
||||
|| val != (long) ((int32) val)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (result)
|
||||
*result = 0; /* suppress compiler warning */
|
||||
return false;
|
||||
}
|
||||
if (result)
|
||||
*result = (int) val;
|
||||
return true;
|
||||
@@ -3449,7 +3457,11 @@ parse_real(const char *value, double *result)
|
||||
errno = 0;
|
||||
val = strtod(value, &endptr);
|
||||
if (endptr == value || *endptr != '\0' || errno == ERANGE)
|
||||
{
|
||||
if (result)
|
||||
*result = 0; /* suppress compiler warning */
|
||||
return false;
|
||||
}
|
||||
if (result)
|
||||
*result = val;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user