mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Remove un-needed braces around single statements.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.27 1998/02/26 04:36:47 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.28 1998/06/15 19:29:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -98,13 +98,9 @@ aclparse(char *s, AclItem *aip, unsigned *modechg)
|
||||
*s != ACL_MODECHG_EQL_CHR)
|
||||
{ /* we just read a keyword, not a name */
|
||||
if (!strcmp(name, ACL_IDTYPE_GID_KEYWORD))
|
||||
{
|
||||
aip->ai_idtype = ACL_IDTYPE_GID;
|
||||
}
|
||||
else if (strcmp(name, ACL_IDTYPE_UID_KEYWORD))
|
||||
{
|
||||
elog(ERROR, "aclparse: bad keyword, must be [group|user]");
|
||||
}
|
||||
s = getid(s, name); /* move s to the name beyond the keyword */
|
||||
if (name[0] == '\0')
|
||||
elog(ERROR, "aclparse: a name must follow the [group|user] keyword");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.29 1998/03/30 16:47:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.30 1998/06/15 19:29:32 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -157,9 +157,7 @@ array_in(char *string, /* input array in external form */
|
||||
ndim++;
|
||||
}
|
||||
else
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ndim == 0)
|
||||
@@ -170,9 +168,7 @@ array_in(char *string, /* input array in external form */
|
||||
for (i = 0; i < ndim; lBound[i++] = 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "array_in: Need to specify dimension");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -273,9 +269,7 @@ _ArrayCount(char *str, int dim[], int typdelim)
|
||||
char *q;
|
||||
|
||||
for (i = 0; i < MAXDIM; ++i)
|
||||
{
|
||||
temp[i] = dim[i] = 0;
|
||||
}
|
||||
|
||||
if (strncmp(str, "{}", 2) == 0)
|
||||
return (0);
|
||||
@@ -292,9 +286,7 @@ _ArrayCount(char *str, int dim[], int typdelim)
|
||||
case '\\':
|
||||
/* skip escaped characters (\ and ") inside strings */
|
||||
if (scanning_string && *(q + 1))
|
||||
{
|
||||
q++;
|
||||
}
|
||||
break;
|
||||
case '\0':
|
||||
|
||||
@@ -343,9 +335,7 @@ _ArrayCount(char *str, int dim[], int typdelim)
|
||||
q++;
|
||||
}
|
||||
for (i = 0; i < ndim; ++i)
|
||||
{
|
||||
dim[i] = temp[i];
|
||||
}
|
||||
|
||||
return (ndim);
|
||||
}
|
||||
@@ -493,13 +483,9 @@ _ReadArrayStr(char *arrayStr,
|
||||
if (values[i])
|
||||
{
|
||||
if (typalign == 'd')
|
||||
{
|
||||
*nbytes += DOUBLEALIGN(*(int32 *) values[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
*nbytes += INTALIGN(*(int32 *) values[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -555,9 +541,7 @@ _ReadLOArray(char *str,
|
||||
str = _AdvanceBy1word(str, &chunkfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "usage: <input file> -chunk DEFAULT/<access pattern file> -invert/-native [-noreorg <chunk file>]");
|
||||
}
|
||||
}
|
||||
|
||||
if (inputfile == NULL)
|
||||
@@ -1040,9 +1024,7 @@ array_clip(ArrayType *array,
|
||||
1, isNull);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ReadArray(lowerIndx, upperIndx, len, fd, newfd, array, 1, isNull);
|
||||
}
|
||||
}
|
||||
#ifdef LOARRAY
|
||||
LOclose(fd);
|
||||
@@ -1245,9 +1227,7 @@ array_assgn(ArrayType *array,
|
||||
|
||||
if (!SanityCheckInput(ndim, n, dim, lb, upperIndx) ||
|
||||
!SanityCheckInput(ndim, n, dim, lb, lowerIndx))
|
||||
{
|
||||
return ((char *) array);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
if (lowerIndx[i] > upperIndx[i])
|
||||
@@ -1338,13 +1318,9 @@ system_cache_lookup(Oid element_type,
|
||||
*typelem = typeStruct->typelem;
|
||||
*typalign = typeStruct->typalign;
|
||||
if (input)
|
||||
{
|
||||
*proc = typeStruct->typinput;
|
||||
}
|
||||
else
|
||||
{
|
||||
*proc = typeStruct->typoutput;
|
||||
}
|
||||
}
|
||||
|
||||
static Datum
|
||||
@@ -1367,9 +1343,7 @@ _ArrayCast(char *value, bool byval, int len)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (Datum) value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1400,9 +1374,7 @@ ArrayCastAndSet(char *src,
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(dest, src, typlen);
|
||||
}
|
||||
inc = typlen;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* workings can be found in the book "Software Solutions in C" by
|
||||
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.23 1998/03/02 00:13:36 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.24 1998/06/15 19:29:32 momjian Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -122,9 +122,7 @@ printf( "cashin- negative symbol; string is '%s'\n", s);
|
||||
|
||||
}
|
||||
else if (*s == psymbol)
|
||||
{
|
||||
s++;
|
||||
}
|
||||
|
||||
#ifdef CASHDEBUG
|
||||
printf( "cashin- string is '%s'\n", s);
|
||||
@@ -687,9 +685,7 @@ cash_words_out(Cash *value)
|
||||
p += 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
*buf = 0;
|
||||
}
|
||||
|
||||
m0 = *value % 100; /* cents */
|
||||
m1 = (*value / 100) % 1000; /* hundreds */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.22 1998/02/26 04:36:59 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.23 1998/06/15 19:29:33 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -175,13 +175,9 @@ int
|
||||
date_cmp(DateADT dateVal1, DateADT dateVal2)
|
||||
{
|
||||
if (dateVal1 < dateVal2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (dateVal1 > dateVal2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* date_cmp() */
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.9 1998/01/05 16:39:52 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.10 1998/06/15 19:29:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -56,9 +56,7 @@ datumGetSize(Datum value, Oid type, bool byVal, Size len)
|
||||
if (byVal)
|
||||
{
|
||||
if (len <= sizeof(Datum))
|
||||
{
|
||||
size = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR,
|
||||
@@ -116,9 +114,7 @@ datumCopy(Datum value, Oid type, bool byVal, Size len)
|
||||
|
||||
|
||||
if (byVal)
|
||||
{
|
||||
res = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value == 0)
|
||||
@@ -131,9 +127,7 @@ datumCopy(Datum value, Oid type, bool byVal, Size len)
|
||||
*/
|
||||
s = (char *) palloc(realSize);
|
||||
if (s == NULL)
|
||||
{
|
||||
elog(ERROR, "datumCopy: out of memory\n");
|
||||
}
|
||||
memmove(s, DatumGetPointer(value), realSize);
|
||||
res = (Datum) s;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.54 1998/06/15 18:39:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.55 1998/06/15 19:29:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -188,9 +188,7 @@ datetime_out(DateTime *dt)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
EncodeSpecialDateTime(DT_INVALID, buf);
|
||||
}
|
||||
|
||||
result = palloc(strlen(buf) + 1);
|
||||
|
||||
@@ -682,9 +680,7 @@ timespan_cmp(TimeSpan *timespan1, TimeSpan *timespan2)
|
||||
|
||||
}
|
||||
else if (TIMESPAN_IS_INVALID(*timespan2))
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
|
||||
span1 = timespan1->time;
|
||||
if (timespan1->month != 0)
|
||||
@@ -727,17 +723,11 @@ datetime_smaller(DateTime *datetime1, DateTime *datetime2)
|
||||
dt2 = SetDateTime(dt2);
|
||||
|
||||
if (DATETIME_IS_INVALID(dt1))
|
||||
{
|
||||
*result = dt2;
|
||||
}
|
||||
else if (DATETIME_IS_INVALID(dt2))
|
||||
{
|
||||
*result = dt1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*result = ((dt2 < dt1) ? dt2 : dt1);
|
||||
}
|
||||
|
||||
return (result);
|
||||
} /* datetime_smaller() */
|
||||
@@ -764,17 +754,11 @@ datetime_larger(DateTime *datetime1, DateTime *datetime2)
|
||||
dt2 = SetDateTime(dt2);
|
||||
|
||||
if (DATETIME_IS_INVALID(dt1))
|
||||
{
|
||||
*result = dt2;
|
||||
}
|
||||
else if (DATETIME_IS_INVALID(dt2))
|
||||
{
|
||||
*result = dt1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*result = ((dt2 > dt1) ? dt2 : dt1);
|
||||
}
|
||||
|
||||
return (result);
|
||||
} /* datetime_larger() */
|
||||
@@ -812,9 +796,7 @@ datetime_mi(DateTime *datetime1, DateTime *datetime2)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result->time = JROUND(dt1 - dt2);
|
||||
}
|
||||
result->month = 0;
|
||||
|
||||
return (result);
|
||||
@@ -894,13 +876,9 @@ datetime_pl_span(DateTime *datetime, TimeSpan *span)
|
||||
if (tm->tm_mday > mdays[tm->tm_mon - 1])
|
||||
{
|
||||
if ((tm->tm_mon == 2) && isleap(tm->tm_year))
|
||||
{
|
||||
tm->tm_mday = (mdays[tm->tm_mon - 1] + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tm->tm_mday = mdays[tm->tm_mon - 1];
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DATEDEBUG
|
||||
@@ -912,9 +890,7 @@ datetime_pl_span(DateTime *datetime, TimeSpan *span)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DATETIME_INVALID(dt);
|
||||
}
|
||||
}
|
||||
|
||||
*result = dt;
|
||||
@@ -1241,15 +1217,11 @@ datetime_age(DateTime *datetime1, DateTime *datetime2)
|
||||
}
|
||||
|
||||
if (tm2timespan(tm, fsec, result) != 0)
|
||||
{
|
||||
elog(ERROR, "Unable to decode datetime", NULL);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Unable to decode datetime", NULL);
|
||||
}
|
||||
|
||||
return (result);
|
||||
} /* datetime_age() */
|
||||
@@ -1676,9 +1648,7 @@ datetime_part(text *units, DateTime *datetime)
|
||||
|
||||
type = DecodeUnits(0, lowunits, &val);
|
||||
if (type == IGNORE)
|
||||
{
|
||||
type = DecodeSpecial(0, lowunits, &val);
|
||||
}
|
||||
|
||||
#ifdef DATEDEBUG
|
||||
if (type == IGNORE)
|
||||
@@ -1843,9 +1813,7 @@ timespan_part(text *units, TimeSpan *timespan)
|
||||
|
||||
type = DecodeUnits(0, lowunits, &val);
|
||||
if (type == IGNORE)
|
||||
{
|
||||
type = DecodeSpecial(0, lowunits, &val);
|
||||
}
|
||||
|
||||
#ifdef DATEDEBUG
|
||||
if (type == IGNORE)
|
||||
@@ -2701,9 +2669,7 @@ ParseDateTime(char *timestr, char *lowstr,
|
||||
* day later
|
||||
*/
|
||||
else
|
||||
{
|
||||
ftype[nf] = DTK_NUMBER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2761,9 +2727,7 @@ ParseDateTime(char *timestr, char *lowstr,
|
||||
/* otherwise something wrong... */
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ignore punctuation but use as delimiter */
|
||||
}
|
||||
@@ -2774,17 +2738,13 @@ ParseDateTime(char *timestr, char *lowstr,
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* force in a delimiter */
|
||||
*lp++ = '\0';
|
||||
nf++;
|
||||
if (nf > MAXDATEFIELDS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#ifdef DATEDEBUG
|
||||
printf("ParseDateTime- set field[%d] to %s type %d\n", (nf - 1), field[nf - 1], ftype[nf - 1]);
|
||||
#endif
|
||||
@@ -3361,9 +3321,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
|
||||
str = cp + 1;
|
||||
tm->tm_sec = strtol(str, &cp, 10);
|
||||
if (*cp == '\0')
|
||||
{
|
||||
*fsec = 0;
|
||||
}
|
||||
else if (*cp == '.')
|
||||
{
|
||||
str = cp;
|
||||
@@ -3372,9 +3330,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* do a sanity check */
|
||||
@@ -3498,19 +3454,13 @@ DecodeNumber(int flen, char *str, int fmask, int *tmask, struct tm * tm, double
|
||||
*tmask = DTK_M(YEAR);
|
||||
tm->tm_year = val;
|
||||
if (tm->tm_year < 70)
|
||||
{
|
||||
tm->tm_year += 2000;
|
||||
}
|
||||
else if (tm->tm_year < 100)
|
||||
{
|
||||
tm->tm_year += 1900;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* DecodeNumber() */
|
||||
@@ -3583,9 +3533,7 @@ DecodeNumberField(int len, char *str, int fmask, int *tmask, struct tm * tm, dou
|
||||
if (cp == (str + 4))
|
||||
return -1;
|
||||
if (*cp == '.')
|
||||
{
|
||||
*fsec = strtod(cp, NULL);
|
||||
}
|
||||
*(str + 4) = '\0';
|
||||
tm->tm_min = strtod((str + 2), &cp);
|
||||
*(str + 2) = '\0';
|
||||
@@ -3593,9 +3541,7 @@ DecodeNumberField(int len, char *str, int fmask, int *tmask, struct tm * tm, dou
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} /* DecodeNumberField() */
|
||||
@@ -3631,9 +3577,7 @@ DecodeTimezone(char *str, int *tzp)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
min = 0;
|
||||
}
|
||||
|
||||
tz = (hr * 60 + min) * 60;
|
||||
if (*str == '-')
|
||||
@@ -3658,9 +3602,7 @@ DecodeSpecial(int field, char *lowtoken, int *val)
|
||||
#if USE_DATE_CACHE
|
||||
if ((datecache[field] != NULL)
|
||||
&& (strncmp(lowtoken, datecache[field]->token, TOKMAXLEN) == 0))
|
||||
{
|
||||
tp = datecache[field];
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
@@ -3942,9 +3884,7 @@ DecodeUnits(int field, char *lowtoken, int *val)
|
||||
#if USE_DATE_CACHE
|
||||
if ((deltacache[field] != NULL)
|
||||
&& (strncmp(lowtoken, deltacache[field]->token, TOKMAXLEN) == 0))
|
||||
{
|
||||
tp = deltacache[field];
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
@@ -3962,13 +3902,9 @@ DecodeUnits(int field, char *lowtoken, int *val)
|
||||
{
|
||||
type = tp->type;
|
||||
if ((type == TZ) || (type == DTZ))
|
||||
{
|
||||
*val = FROMVAL(tp);
|
||||
}
|
||||
else
|
||||
{
|
||||
*val = tp->value;
|
||||
}
|
||||
}
|
||||
|
||||
return (type);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.14 1998/02/26 04:37:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.15 1998/06/15 19:29:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -111,14 +111,10 @@ filename_in(char *file)
|
||||
ind = len + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Couldn't find %s in your environment", environment);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ind = 0;
|
||||
}
|
||||
strcat(str, file + ind);
|
||||
return (str);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.32 1998/05/09 22:39:55 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.33 1998/06/15 19:29:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -254,9 +254,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p)
|
||||
s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
*ss = s;
|
||||
|
||||
@@ -960,9 +958,7 @@ line_parallel(LINE *l1, LINE *l2)
|
||||
return (FPeq(l1->m, l2->m));
|
||||
#endif
|
||||
if (FPzero(l1->B))
|
||||
{
|
||||
return (FPzero(l2->B));
|
||||
}
|
||||
|
||||
return (FPeq(l2->A, l1->A * (l2->B / l1->B)));
|
||||
} /* line_parallel() */
|
||||
@@ -977,13 +973,9 @@ line_perp(LINE *l1, LINE *l2)
|
||||
return (FPeq(l1->m / l2->m, -1.0));
|
||||
#endif
|
||||
if (FPzero(l1->A))
|
||||
{
|
||||
return (FPzero(l2->B));
|
||||
}
|
||||
else if (FPzero(l1->B))
|
||||
{
|
||||
return (FPzero(l2->A));
|
||||
}
|
||||
|
||||
return (FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0));
|
||||
} /* line_perp() */
|
||||
@@ -1396,9 +1388,7 @@ path_distance(PATH *p1, PATH *p2)
|
||||
min = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
pfree(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
return (min);
|
||||
@@ -2007,9 +1997,7 @@ dist_ps(Point *pt, LSEG *lseg)
|
||||
* and through the input point
|
||||
*/
|
||||
if (lseg->p[1].x == lseg->p[0].x)
|
||||
{
|
||||
m = 0;
|
||||
}
|
||||
else if (lseg->p[1].y == lseg->p[0].y)
|
||||
{ /* slope is infinite */
|
||||
m = (double) DBL_MAX;
|
||||
@@ -2140,9 +2128,7 @@ dist_sl(LSEG *lseg, LINE *line)
|
||||
result = d2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pfree(d2);
|
||||
}
|
||||
}
|
||||
|
||||
return (result);
|
||||
@@ -2998,9 +2984,7 @@ make_bound_box(POLYGON *poly)
|
||||
box_fill(&(poly->boundbox), x1, x2, y1, y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Unable to create bounding box for empty polygon", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
@@ -3717,9 +3701,7 @@ poly_center(POLYGON *poly)
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
return (result);
|
||||
} /* poly_center() */
|
||||
@@ -3935,9 +3917,7 @@ circle_in(char *str)
|
||||
while (isspace(*cp))
|
||||
cp++;
|
||||
if (*cp == LDELIM)
|
||||
{
|
||||
s = cp;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pair_decode(s, &circle->center.x, &circle->center.y, &s))
|
||||
@@ -3962,9 +3942,7 @@ circle_in(char *str)
|
||||
s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
elog(ERROR, "Bad circle external representation '%s'", str);
|
||||
}
|
||||
}
|
||||
|
||||
if (*s != '\0')
|
||||
@@ -4511,9 +4489,7 @@ poly_circle(POLYGON *poly)
|
||||
circle->center.y /= poly->npts;
|
||||
|
||||
for (i = 0; i < poly->npts; i++)
|
||||
{
|
||||
circle->radius += point_dt(&poly->p[i], &circle->center);
|
||||
}
|
||||
circle->radius /= poly->npts;
|
||||
|
||||
if (FPzero(circle->radius))
|
||||
@@ -4570,23 +4546,17 @@ point_inside(Point *p, int npts, Point plist[])
|
||||
y = plist[i].y - p->y;
|
||||
|
||||
if ((cross = lseg_crossing(x, y, px, py)) == HIT_IT)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
crossnum += cross;
|
||||
|
||||
px = x;
|
||||
py = y;
|
||||
}
|
||||
if ((cross = lseg_crossing(x0, y0, px, py)) == HIT_IT)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
crossnum += cross;
|
||||
if (crossnum != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} /* point_inside() */
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.42 1998/02/26 04:37:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.43 1998/06/15 19:29:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -131,9 +131,7 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
|
||||
|
||||
#ifdef USE_POSIX_TIME
|
||||
if (tzp != NULL)
|
||||
{
|
||||
tx = localtime((time_t *) &time);
|
||||
}
|
||||
else
|
||||
{
|
||||
tx = gmtime((time_t *) &time);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.12 1998/05/29 13:31:52 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.13 1998/06/15 19:29:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -219,9 +219,7 @@ NameComputeLength(Name name)
|
||||
for (length = 0, charP = name->data;
|
||||
length < NAMEDATALEN && *charP != '\0';
|
||||
length++, charP++)
|
||||
{
|
||||
;
|
||||
}
|
||||
return (uint32) length;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.8 1998/01/31 04:38:45 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.9 1998/06/15 19:29:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -89,9 +89,7 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
|
||||
|
||||
integer_value = DatumGetInt16(value);
|
||||
if (left_side_argument == integer_value)
|
||||
{
|
||||
retval = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* close the relation */
|
||||
@@ -120,9 +118,7 @@ my_varattno(Relation rd, char *a)
|
||||
for (i = 0; i < rd->rd_rel->relnatts; i++)
|
||||
{
|
||||
if (!namestrcmp(&rd->rd_att->attrs[i]->attname, a))
|
||||
{
|
||||
return (i + 1);
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.23 1998/02/26 04:37:14 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.24 1998/06/15 19:29:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -236,9 +236,7 @@ ftoa(double value, char *ascii, int width, int prec1, char format)
|
||||
/* output left of dp */
|
||||
expon--;
|
||||
if (*p)
|
||||
{
|
||||
*a++ = *p++;
|
||||
}
|
||||
else
|
||||
*a++ = '0';
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.5 1998/02/26 04:37:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.6 1998/06/15 19:29:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -31,13 +31,9 @@ oidint2in(char *o)
|
||||
|
||||
oi->oi_oid = (Oid) pg_atoi(o, sizeof(Oid), '/');
|
||||
if (*p == '\0')
|
||||
{
|
||||
oi->oi_int2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi->oi_int2 = (int16) pg_atoi(++p, sizeof(int2), '\0');
|
||||
}
|
||||
|
||||
return (oi);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.5 1998/02/26 04:37:17 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.6 1998/06/15 19:29:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -30,13 +30,9 @@ oidint4in(char *o)
|
||||
|
||||
oi->oi_oid = (Oid) pg_atoi(o, sizeof(Oid), '/');
|
||||
if (*p == '\0')
|
||||
{
|
||||
oi->oi_int4 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
oi->oi_int4 = pg_atoi(++p, sizeof(int4), '\0');
|
||||
}
|
||||
|
||||
return (oi);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Edmund Mergl <E.Mergl@bawue.de>
|
||||
*
|
||||
* $Id: oracle_compat.c,v 1.13 1998/04/27 17:08:19 scrappy Exp $
|
||||
* $Id: oracle_compat.c,v 1.14 1998/06/15 19:29:36 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -54,9 +54,7 @@ lower(text *string)
|
||||
ptr_ret = VARDATA(ret);
|
||||
|
||||
while (m--)
|
||||
{
|
||||
*ptr_ret++ = tolower((unsigned char)*ptr++);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -94,9 +92,7 @@ upper(text *string)
|
||||
ptr_ret = VARDATA(ret);
|
||||
|
||||
while (m--)
|
||||
{
|
||||
*ptr_ret++ = toupper((unsigned char)*ptr++);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -141,13 +137,9 @@ initcap(text *string)
|
||||
while (m--)
|
||||
{
|
||||
if (*(ptr_ret - 1) == ' ' || *(ptr_ret - 1) == ' ')
|
||||
{
|
||||
*ptr_ret++ = toupper((unsigned char)*ptr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr_ret++ = tolower((unsigned char)*ptr++);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -202,9 +194,7 @@ lpad(text *string1, int4 len, text *string2)
|
||||
ptr1 = VARDATA(string1);
|
||||
|
||||
while (n--)
|
||||
{
|
||||
*ptr_ret++ = *ptr1++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -250,9 +240,7 @@ rpad(text *string1, int4 len, text *string2)
|
||||
ptr_ret = VARDATA(ret);
|
||||
|
||||
while (n--)
|
||||
{
|
||||
*ptr_ret++ = *ptr1++;
|
||||
}
|
||||
|
||||
ptr2 = VARDATA(string2);
|
||||
|
||||
@@ -306,15 +294,11 @@ btrim(text *string, text *set)
|
||||
while (ptr2 <= end2)
|
||||
{
|
||||
if (*ptr == *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
++ptr2;
|
||||
}
|
||||
if (*ptr != *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
ptr2 = VARDATA(set);
|
||||
}
|
||||
@@ -329,15 +313,11 @@ btrim(text *string, text *set)
|
||||
while (ptr2 <= end2)
|
||||
{
|
||||
if (*end == *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
++ptr2;
|
||||
}
|
||||
if (*end != *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--end;
|
||||
ptr2 = VARDATA(set);
|
||||
}
|
||||
@@ -391,15 +371,11 @@ ltrim(text *string, text *set)
|
||||
while (ptr2 <= end2)
|
||||
{
|
||||
if (*ptr == *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
++ptr2;
|
||||
}
|
||||
if (*ptr != *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ptr++;
|
||||
ptr2 = VARDATA(set);
|
||||
}
|
||||
@@ -455,15 +431,11 @@ rtrim(text *string, text *set)
|
||||
while (ptr2 <= end2)
|
||||
{
|
||||
if (*ptr == *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
++ptr2;
|
||||
}
|
||||
if (*ptr != *ptr2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--ptr;
|
||||
ptr2 = VARDATA(set);
|
||||
}
|
||||
@@ -479,9 +451,7 @@ rtrim(text *string, text *set)
|
||||
ptr_ret = VARDATA(ret) + m - 1;
|
||||
|
||||
while (m--)
|
||||
{
|
||||
*ptr_ret-- = *ptr--;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -524,9 +494,7 @@ substr(text *string, int4 m, int4 n)
|
||||
ptr_ret = VARDATA(ret);
|
||||
|
||||
while (len--)
|
||||
{
|
||||
*ptr_ret++ = *ptr++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.17 1998/04/26 04:07:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.18 1998/06/15 19:29:36 momjian Exp $
|
||||
*
|
||||
* Alistair Crooks added the code for the regex caching
|
||||
* agc - cached the regular expressions used - there's a good chance
|
||||
@@ -97,15 +97,11 @@ RE_compile_and_execute(struct varlena * text_re, char *text, int cflags)
|
||||
for (oldest = 0, i = 1; i < rec; i++)
|
||||
{
|
||||
if (rev[i].cre_lru < rev[oldest].cre_lru)
|
||||
{
|
||||
oldest = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
oldest = rec++;
|
||||
}
|
||||
|
||||
/* if there was an old re, then de-allocate the space it used */
|
||||
if (rev[oldest].cre_s != (char *) NULL)
|
||||
@@ -115,9 +111,7 @@ RE_compile_and_execute(struct varlena * text_re, char *text, int cflags)
|
||||
rev[i].cre_lru =
|
||||
(rev[i].cre_lru - rev[oldest].cre_lru) / 2;
|
||||
if (rev[i].cre_lru > lru)
|
||||
{
|
||||
lru = rev[i].cre_lru;
|
||||
}
|
||||
}
|
||||
pg95_regfree(&rev[oldest].cre_re);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.18 1998/04/26 04:07:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -72,9 +72,7 @@ regprocin(char *proname)
|
||||
RelationGetTupleDescriptor(proc),
|
||||
&isnull);
|
||||
if (isnull)
|
||||
{
|
||||
elog(FATAL, "regprocin: null procedure %s", proname);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
result = (RegProcedure) 0;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.18 1998/02/26 04:37:21 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.19 1998/06/15 19:29:37 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -506,13 +506,9 @@ hashsel(Oid operatorObjectId,
|
||||
}
|
||||
ntuples = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
|
||||
if (ntuples > 0)
|
||||
{
|
||||
resultData = 1.0 / (float64data) ntuples;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultData = (float64data) (1.0 / 100.0);
|
||||
}
|
||||
result = &resultData;
|
||||
|
||||
}
|
||||
@@ -573,13 +569,9 @@ hashnpage(Oid operatorObjectId,
|
||||
|
||||
ntuples = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
|
||||
if (ntuples > 0)
|
||||
{
|
||||
tempData = 1.0 / (float64data) ntuples;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempData = (float64data) (1.0 / 100.0);
|
||||
}
|
||||
temp = &tempData;
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.32 1998/05/29 13:33:24 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.33 1998/06/15 19:29:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -98,9 +98,7 @@ bpcharin(char *s, int dummy, int16 atttypmod)
|
||||
|
||||
/* blank pad the string if necessary */
|
||||
for (; i < len; i++)
|
||||
{
|
||||
*r++ = ' ';
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -186,9 +184,7 @@ printf("'\n");
|
||||
|
||||
/* blank pad the string if necessary */
|
||||
for (; i < rlen; i++)
|
||||
{
|
||||
*r++ = ' ';
|
||||
}
|
||||
|
||||
return (result);
|
||||
} /* bpchar() */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.35 1998/05/29 13:33:58 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.36 1998/06/15 19:29:38 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -657,13 +657,9 @@ byteaGetBit(text *v, int32 n)
|
||||
byte = byteaGetByte(v, byteNo);
|
||||
|
||||
if (byte & (1 << bitNo))
|
||||
{
|
||||
return ((int32) 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((int32) 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------
|
||||
@@ -729,9 +725,7 @@ byteaSetBit(text *v, int32 n, int32 newBit)
|
||||
* sanity check!
|
||||
*/
|
||||
if (newBit != 0 && newBit != 1)
|
||||
{
|
||||
elog(ERROR, "byteaSetByte: new bit must be 0 or 1");
|
||||
}
|
||||
|
||||
/*
|
||||
* get the byte where the bit we want is stored.
|
||||
@@ -744,13 +738,9 @@ byteaSetBit(text *v, int32 n, int32 newBit)
|
||||
* calculate the new value for that byte
|
||||
*/
|
||||
if (newBit == 0)
|
||||
{
|
||||
newByte = oldByte & (~(1 << bitNo));
|
||||
}
|
||||
else
|
||||
{
|
||||
newByte = oldByte | (1 << bitNo);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: 'byteaSetByte' creates a copy of 'v' & sets the byte.
|
||||
|
||||
Reference in New Issue
Block a user