]> granicus.if.org Git - postgresql/commitdiff
Remove unnecessary parentheses in assignments.
authorBruce Momjian <bruce@momjian.us>
Thu, 21 Jul 2005 04:41:43 +0000 (04:41 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 21 Jul 2005 04:41:43 +0000 (04:41 +0000)
Add spaces where needed.
Reference time interval variables as tinterval.

src/backend/utils/adt/acl.c
src/backend/utils/adt/cash.c
src/backend/utils/adt/date.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/nabstime.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/varlena.c

index 3fedb33a8a51fbdfa19d1e5ba0c8607ad5f9ac46..36d53ca9ffc2e695876bf94c7a75c1f62256002c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.119 2005/07/14 21:46:30 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.120 2005/07/21 04:41:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1017,7 +1017,7 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
                if (aidata->ai_grantee == ACL_ID_PUBLIC ||
                        aidata->ai_grantee == roleid)
                {
-                       result |= (aidata->ai_privs & mask);
+                       result |= aidata->ai_privs & mask;
                        if ((how == ACLMASK_ALL) ? (result == mask) : (result != 0))
                                return result;
                }
@@ -1030,7 +1030,7 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
         * a given ACL entry grants any privileges still of interest before
         * we perform the is_member test.
         */
-       remaining = (mask & ~result);
+       remaining = mask & ~result;
        for (i = 0; i < num; i++)
        {
                AclItem    *aidata = &aidat[i];
@@ -1042,10 +1042,10 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
                if ((aidata->ai_privs & remaining) &&
                        is_member_of_role(roleid, aidata->ai_grantee))
                {
-                       result |= (aidata->ai_privs & mask);
+                       result |= aidata->ai_privs & mask;
                        if ((how == ACLMASK_ALL) ? (result == mask) : (result != 0))
                                return result;
-                       remaining = (mask & ~result);
+                       remaining = mask & ~result;
                }
        }
 
index 1c88d9439e8e27de41ae62cf1b7a1f386ef85351..8788af9f87ea8f0a22a631f4a7ca1013e4318311 100644 (file)
@@ -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.
  *
- * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.64 2004/08/29 05:06:49 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.65 2005/07/21 04:41:43 momjian Exp $
  */
 
 #include "postgres.h"
@@ -197,7 +197,7 @@ cash_in(PG_FUNCTION_ARGS)
                                (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                        errmsg("invalid input syntax for type money: \"%s\"", str)));
 
-       result = (value * sgn);
+       result = value * sgn;
 
 #ifdef CASHDEBUG
        printf("cashin- result is %d\n", result);
index 106bec853077d0f22af933aee0c210044c052e13..828ca9ec7c9738dd6c95e02260856e5c795a05ba 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.114 2005/07/21 03:56:13 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.115 2005/07/21 04:41:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -304,8 +304,7 @@ date2timestamptz(DateADT dateVal)
        tz = DetermineLocalTimeZone(tm);
 
 #ifdef HAVE_INT64_TIMESTAMP
-       result = (dateVal * USECS_PER_DAY)
-               + (tz * USECS_PER_SEC);
+       result = dateVal * USECS_PER_DAY + tz * USECS_PER_SEC;
 #else
        result = dateVal * (double)SECS_PER_DAY + tz;
 #endif
@@ -725,7 +724,7 @@ timestamp_date(PG_FUNCTION_ARGS)
        if (TIMESTAMP_NOT_FINITE(timestamp))
                PG_RETURN_NULL();
 
-       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                ereport(ERROR,
                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                 errmsg("timestamp out of range")));
@@ -768,7 +767,7 @@ timestamptz_date(PG_FUNCTION_ARGS)
        if (TIMESTAMP_NOT_FINITE(timestamp))
                PG_RETURN_NULL();
 
-       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                ereport(ERROR,
                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                 errmsg("timestamp out of range")));
@@ -829,7 +828,7 @@ date_text(PG_FUNCTION_ARGS)
 
        str = DatumGetCString(DirectFunctionCall1(date_out, date));
 
-       len = (strlen(str) + VARHDRSZ);
+       len = strlen(str) + VARHDRSZ;
 
        result = palloc(len);
 
@@ -1337,7 +1336,7 @@ timestamp_time(PG_FUNCTION_ARGS)
        if (TIMESTAMP_NOT_FINITE(timestamp))
                PG_RETURN_NULL();
 
-       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                ereport(ERROR,
                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                 errmsg("timestamp out of range")));
@@ -1374,7 +1373,7 @@ timestamptz_time(PG_FUNCTION_ARGS)
        if (TIMESTAMP_NOT_FINITE(timestamp))
                PG_RETURN_NULL();
 
-       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                ereport(ERROR,
                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                 errmsg("timestamp out of range")));
@@ -1496,14 +1495,14 @@ time_pl_interval(PG_FUNCTION_ARGS)
        TimeADT         result;
 
 #ifdef HAVE_INT64_TIMESTAMP
-       result = (time + span->time);
-       result -= (result / USECS_PER_DAY * USECS_PER_DAY);
+       result = time + span->time;
+       result -= result / USECS_PER_DAY * USECS_PER_DAY;
        if (result < INT64CONST(0))
                result += USECS_PER_DAY;
 #else
        TimeADT         time1;
 
-       result = (time + span->time);
+       result = time + span->time;
        TMODULO(result, time1, (double)SECS_PER_DAY);
        if (result < 0)
                result += SECS_PER_DAY;
@@ -1523,14 +1522,14 @@ time_mi_interval(PG_FUNCTION_ARGS)
        TimeADT         result;
 
 #ifdef HAVE_INT64_TIMESTAMP
-       result = (time - span->time);
-       result -= (result / USECS_PER_DAY * USECS_PER_DAY);
+       result = time - span->time;
+       result -= result / USECS_PER_DAY * USECS_PER_DAY;
        if (result < INT64CONST(0))
                result += USECS_PER_DAY;
 #else
        TimeADT         time1;
 
-       result = (time - span->time);
+       result = time - span->time;
        TMODULO(result, time1, (double)SECS_PER_DAY);
        if (result < 0)
                result += SECS_PER_DAY;
@@ -1554,7 +1553,7 @@ time_text(PG_FUNCTION_ARGS)
 
        str = DatumGetCString(DirectFunctionCall1(time_out, time));
 
-       len = (strlen(str) + VARHDRSZ);
+       len = strlen(str) + VARHDRSZ;
 
        result = palloc(len);
 
@@ -1685,7 +1684,7 @@ time_part(PG_FUNCTION_ARGS)
        else if (type == RESERV && val == DTK_EPOCH)
        {
 #ifdef HAVE_INT64_TIMESTAMP
-               result = (time / 1000000.0);
+               result = time / 1000000.0;
 #else
                result = time;
 #endif
@@ -2036,12 +2035,12 @@ timetz_pl_interval(PG_FUNCTION_ARGS)
        result = (TimeTzADT *) palloc(sizeof(TimeTzADT));
 
 #ifdef HAVE_INT64_TIMESTAMP
-       result->time = (time->time + span->time);
-       result->time -= (result->time / USECS_PER_DAY * USECS_PER_DAY);
+       result->time = time->time + span->time;
+       result->time -= result->time / USECS_PER_DAY * USECS_PER_DAY;
        if (result->time < INT64CONST(0))
                result->time += USECS_PER_DAY;
 #else
-       result->time = (time->time + span->time);
+       result->time = time->time + span->time;
        TMODULO(result->time, time1.time, (double)SECS_PER_DAY);
        if (result->time < 0)
                result->time += SECS_PER_DAY;
@@ -2069,12 +2068,12 @@ timetz_mi_interval(PG_FUNCTION_ARGS)
        result = (TimeTzADT *) palloc(sizeof(TimeTzADT));
 
 #ifdef HAVE_INT64_TIMESTAMP
-       result->time = (time->time - span->time);
-       result->time -= (result->time / USECS_PER_DAY * USECS_PER_DAY);
+       result->time = time->time - span->time;
+       result->time -= result->time / USECS_PER_DAY * USECS_PER_DAY;
        if (result->time < INT64CONST(0))
                result->time += USECS_PER_DAY;
 #else
-       result->time = (time->time - span->time);
+       result->time = time->time - span->time;
        TMODULO(result->time, time1.time, (double)SECS_PER_DAY);
        if (result->time < 0)
                result->time += SECS_PER_DAY;
@@ -2265,7 +2264,7 @@ timestamptz_timetz(PG_FUNCTION_ARGS)
        if (TIMESTAMP_NOT_FINITE(timestamp))
                PG_RETURN_NULL();
 
-       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                ereport(ERROR,
                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                 errmsg("timestamp out of range")));
@@ -2315,7 +2314,7 @@ timetz_text(PG_FUNCTION_ARGS)
 
        str = DatumGetCString(DirectFunctionCall1(timetz_out, timetz));
 
-       len = (strlen(str) + VARHDRSZ);
+       len = strlen(str) + VARHDRSZ;
 
        result = palloc(len);
 
@@ -2497,7 +2496,8 @@ timetz_zone(PG_FUNCTION_ARGS)
        pg_time_t   now;
 
        /* Find the specified timezone */ 
-       len = (VARSIZE(zone)-VARHDRSZ>TZ_STRLEN_MAX)?TZ_STRLEN_MAX:(VARSIZE(zone)-VARHDRSZ);
+       len = (VARSIZE(zone)-VARHDRSZ>TZ_STRLEN_MAX) ?
+                                       TZ_STRLEN_MAX : VARSIZE(zone) - VARHDRSZ;
        memcpy(tzname,VARDATA(zone),len);
        tzname[len]=0;
        tzp = pg_tzset(tzname);
index 32df7b78db2b9275a2d4af33178171e5de84c64f..681ec03924776f34871b9cee7679d747dd5a1dd7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.153 2005/07/21 03:56:14 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.154 2005/07/21 04:41:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -3275,8 +3275,8 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct pg_tm * tm,
                int                     sec;
 
 #ifdef HAVE_INT64_TIMESTAMP
-               sec = (*fsec / USECS_PER_SEC);
-               *fsec -= (sec * USECS_PER_SEC);
+               sec = *fsec / USECS_PER_SEC;
+               *fsec -= sec * USECS_PER_SEC;
 #else
                TMODULO(*fsec, sec, 1.0);
 #endif
index c1931ca14aea1bc8192d3368156dbdb70c3b7bae..df5dc51ba21b7a0cecbc8e335024cefc0cee93fd 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.137 2005/07/21 03:56:18 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.138 2005/07/21 04:41:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,8 +49,8 @@
 
 #define IsSpace(C)                             ((C) == ' ')
 
-#define T_INTERVAL_INVAL   0   /* data represents no valid interval */
-#define T_INTERVAL_VALID   1   /* data represents a valid interval */
+#define T_INTERVAL_INVAL   0   /* data represents no valid tinterval */
+#define T_INTERVAL_VALID   1   /* data represents a valid tinterval */
 /*
  * ['Mon May 10 23:59:12 1943 PST' 'Sun Jan 14 03:14:21 1973 PST']
  * 0           1                 2                     3                 4                     5                 6
@@ -712,64 +712,64 @@ reltime2tm(RelativeTime time, struct pg_tm * tm)
 
 
 /*
- *             tintervalin             - converts an interval string to internal format
+ *             tintervalin             - converts an tinterval string to internal format
  */
 Datum
 tintervalin(PG_FUNCTION_ARGS)
 {
-       char       *intervalstr = PG_GETARG_CSTRING(0);
-       TimeInterval interval;
+       char       *tintervalstr = PG_GETARG_CSTRING(0);
+       TimeInterval tinterval;
        AbsoluteTime i_start,
                                i_end,
                                t1,
                                t2;
 
-       interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
+       tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
 
-       if (istinterval(intervalstr, &t1, &t2) == 0)
+       if (istinterval(tintervalstr, &t1, &t2) == 0)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_DATETIME_FORMAT),
                                 errmsg("invalid input syntax for type tinterval: \"%s\"",
-                                               intervalstr)));
+                                               tintervalstr)));
 
        if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
-               interval  ->status = T_INTERVAL_INVAL;  /* undefined  */
+               tinterval  ->status = T_INTERVAL_INVAL; /* undefined  */
 
        else
-               interval  ->status = T_INTERVAL_VALID;
+               tinterval  ->status = T_INTERVAL_VALID;
 
        i_start = ABSTIMEMIN(t1, t2);
        i_end = ABSTIMEMAX(t1, t2);
-       interval  ->data[0] = i_start;
-       interval  ->data[1] = i_end;
+       tinterval  ->data[0] = i_start;
+       tinterval  ->data[1] = i_end;
 
-       PG_RETURN_TIMEINTERVAL(interval);
+       PG_RETURN_TIMEINTERVAL(tinterval);
 }
 
 
 /*
- *             tintervalout    - converts an internal interval format to a string
+ *             tintervalout    - converts an internal tinterval format to a string
  */
 Datum
 tintervalout(PG_FUNCTION_ARGS)
 {
-       TimeInterval interval = PG_GETARG_TIMEINTERVAL(0);
+       TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(0);
        char       *i_str,
                           *p;
 
        i_str = (char *) palloc(T_INTERVAL_LEN);        /* ["..." "..."] */
        strcpy(i_str, "[\"");
-       if (interval->status == T_INTERVAL_INVAL)
+       if (tinterval->status == T_INTERVAL_INVAL)
                strcat(i_str, INVALID_INTERVAL_STR);
        else
        {
                p = DatumGetCString(DirectFunctionCall1(abstimeout,
-                                                          AbsoluteTimeGetDatum(interval->data[0])));
+                                                          AbsoluteTimeGetDatum(tinterval->data[0])));
                strcat(i_str, p);
                pfree(p);
                strcat(i_str, "\" \"");
                p = DatumGetCString(DirectFunctionCall1(abstimeout,
-                                                          AbsoluteTimeGetDatum(interval->data[1])));
+                                                          AbsoluteTimeGetDatum(tinterval->data[1])));
                strcat(i_str, p);
                pfree(p);
        }
@@ -784,22 +784,22 @@ Datum
 tintervalrecv(PG_FUNCTION_ARGS)
 {
        StringInfo      buf = (StringInfo) PG_GETARG_POINTER(0);
-       TimeInterval interval;
+       TimeInterval tinterval;
 
-       interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
+       tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
 
-       interval  ->status = pq_getmsgint(buf, sizeof(interval->status));
+       tinterval  ->status = pq_getmsgint(buf, sizeof(tinterval->status));
 
-       if (!(interval->status == T_INTERVAL_INVAL ||
-                 interval->status == T_INTERVAL_VALID))
+       if (!(tinterval->status == T_INTERVAL_INVAL ||
+                 tinterval->status == T_INTERVAL_VALID))
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION),
                          errmsg("invalid status in external \"tinterval\" value")));
 
-       interval  ->data[0] = pq_getmsgint(buf, sizeof(interval->data[0]));
-       interval  ->data[1] = pq_getmsgint(buf, sizeof(interval->data[1]));
+       tinterval  ->data[0] = pq_getmsgint(buf, sizeof(tinterval->data[0]));
+       tinterval  ->data[1] = pq_getmsgint(buf, sizeof(tinterval->data[1]));
 
-       PG_RETURN_TIMEINTERVAL(interval);
+       PG_RETURN_TIMEINTERVAL(tinterval);
 }
 
 /*
@@ -808,13 +808,13 @@ tintervalrecv(PG_FUNCTION_ARGS)
 Datum
 tintervalsend(PG_FUNCTION_ARGS)
 {
-       TimeInterval interval = PG_GETARG_TIMEINTERVAL(0);
+       TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(0);
        StringInfoData buf;
 
        pq_begintypsend(&buf);
-       pq_sendint(&buf, interval->status, sizeof(interval->status));
-       pq_sendint(&buf, interval->data[0], sizeof(interval->data[0]));
-       pq_sendint(&buf, interval->data[1], sizeof(interval->data[1]));
+       pq_sendint(&buf, tinterval->status, sizeof(tinterval->status));
+       pq_sendint(&buf, tinterval->data[0], sizeof(tinterval->data[0]));
+       pq_sendint(&buf, tinterval->data[1], sizeof(tinterval->data[1]));
        PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
 }
 
@@ -884,10 +884,10 @@ reltime_interval(PG_FUNCTION_ARGS)
 
                default:
 #ifdef HAVE_INT64_TIMESTAMP
-                       year = (reltime / (36525 * 864));
-                       reltime -= (year * (36525 * 864));
-                       month = (reltime / (DAYS_PER_MONTH * SECS_PER_DAY));
-                       reltime -= (month * (DAYS_PER_MONTH * SECS_PER_DAY));
+                       year = reltime / (36525 * 864);
+                       reltime -= year * (36525 * 864);
+                       month = reltime / (DAYS_PER_MONTH * SECS_PER_DAY);
+                       reltime -= month * (DAYS_PER_MONTH * SECS_PER_DAY);
                        day = reltime / SECS_PER_DAY;
                        reltime -= day * SECS_PER_DAY;
 
@@ -918,21 +918,21 @@ mktinterval(PG_FUNCTION_ARGS)
        AbsoluteTime t2 = PG_GETARG_ABSOLUTETIME(1);
        AbsoluteTime tstart = ABSTIMEMIN(t1, t2);
        AbsoluteTime tend = ABSTIMEMAX(t1, t2);
-       TimeInterval interval;
+       TimeInterval tinterval;
 
-       interval = (TimeInterval) palloc(sizeof(TimeIntervalData));
+       tinterval = (TimeInterval) palloc(sizeof(TimeIntervalData));
 
        if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
-               interval  ->status = T_INTERVAL_INVAL;
+               tinterval->status = T_INTERVAL_INVAL;
 
        else
        {
-               interval  ->status = T_INTERVAL_VALID;
-               interval  ->data[0] = tstart;
-               interval  ->data[1] = tend;
+               tinterval->status = T_INTERVAL_VALID;
+               tinterval->data[0] = tstart;
+               tinterval->data[1] = tend;
        }
 
-       PG_RETURN_TIMEINTERVAL(interval);
+       PG_RETURN_TIMEINTERVAL(tinterval);
 }
 
 /*
@@ -981,38 +981,38 @@ timemi(PG_FUNCTION_ARGS)
 
 
 /*
- *             intinterval             - returns true iff absolute date is in the interval
+ *             intinterval             - returns true iff absolute date is in the tinterval
  */
 Datum
 intinterval(PG_FUNCTION_ARGS)
 {
        AbsoluteTime t = PG_GETARG_ABSOLUTETIME(0);
-       TimeInterval interval = PG_GETARG_TIMEINTERVAL(1);
+       TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(1);
 
-       if (interval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME)
+       if (tinterval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME)
        {
                if (DatumGetBool(DirectFunctionCall2(abstimege,
                                                                                         AbsoluteTimeGetDatum(t),
-                                                        AbsoluteTimeGetDatum(interval->data[0]))) &&
+                                                        AbsoluteTimeGetDatum(tinterval->data[0]))) &&
                        DatumGetBool(DirectFunctionCall2(abstimele,
                                                                                         AbsoluteTimeGetDatum(t),
-                                                          AbsoluteTimeGetDatum(interval->data[1]))))
+                                                          AbsoluteTimeGetDatum(tinterval->data[1]))))
                        PG_RETURN_BOOL(true);
        }
        PG_RETURN_BOOL(false);
 }
 
 /*
- *             tintervalrel            - returns  relative time corresponding to interval
+ *             tintervalrel            - returns  relative time corresponding to tinterval
  */
 Datum
 tintervalrel(PG_FUNCTION_ARGS)
 {
-       TimeInterval interval = PG_GETARG_TIMEINTERVAL(0);
-       AbsoluteTime t1 = interval->data[0];
-       AbsoluteTime t2 = interval->data[1];
+       TimeInterval tinterval = PG_GETARG_TIMEINTERVAL(0);
+       AbsoluteTime t1 = tinterval->data[0];
+       AbsoluteTime t2 = tinterval->data[1];
 
-       if (interval->status != T_INTERVAL_VALID)
+       if (tinterval->status != T_INTERVAL_VALID)
                PG_RETURN_RELATIVETIME(INVALID_RELTIME);
 
        if (AbsoluteTimeIsReal(t1) &&
@@ -1134,7 +1134,7 @@ btreltimecmp(PG_FUNCTION_ARGS)
 
 
 /*
- *             tintervalsame   - returns true iff interval i1 is same as interval i2
+ *             tintervalsame   - returns true iff tinterval i1 is same as tinterval i2
  *             Check begin and end time.
  */
 Datum
@@ -1159,7 +1159,7 @@ tintervalsame(PG_FUNCTION_ARGS)
 /*
  * tinterval comparison routines
  *
- * Note: comparison is based on the lengths of the intervals, not on
+ * Note: comparison is based on the lengths of the tintervals, not on
  * endpoint value.     This is pretty bogus, but since it's only a legacy
  * datatype I'm not going to propose changing it.
  */
@@ -1270,17 +1270,17 @@ bttintervalcmp(PG_FUNCTION_ARGS)
 
 
 /*
- *             tintervalleneq  - returns true iff length of interval i is equal to
+ *             tintervalleneq  - returns true iff length of tinterval i is equal to
  *                                                             reltime t
- *             tintervallenne  - returns true iff length of interval i is not equal
+ *             tintervallenne  - returns true iff length of tinterval i is not equal
  *                                                             to reltime t
- *             tintervallenlt  - returns true iff length of interval i is less than
+ *             tintervallenlt  - returns true iff length of tinterval i is less than
  *                                                             reltime t
- *             tintervallengt  - returns true iff length of interval i is greater
+ *             tintervallengt  - returns true iff length of tinterval i is greater
  *                                                             than reltime t
- *             tintervallenle  - returns true iff length of interval i is less or
+ *             tintervallenle  - returns true iff length of tinterval i is less or
  *                                                             equal than reltime t
- *             tintervallenge  - returns true iff length of interval i is greater or
+ *             tintervallenge  - returns true iff length of tinterval i is greater or
  *                                                             equal than reltime t
  */
 Datum
@@ -1368,7 +1368,7 @@ tintervallenge(PG_FUNCTION_ARGS)
 }
 
 /*
- *             tintervalct             - returns true iff interval i1 contains interval i2
+ *             tintervalct             - returns true iff tinterval i1 contains tinterval i2
  */
 Datum
 tintervalct(PG_FUNCTION_ARGS)
@@ -1389,7 +1389,7 @@ tintervalct(PG_FUNCTION_ARGS)
 }
 
 /*
- *             tintervalov             - returns true iff interval i1 (partially) overlaps i2
+ *             tintervalov             - returns true iff tinterval i1 (partially) overlaps i2
  */
 Datum
 tintervalov(PG_FUNCTION_ARGS)
@@ -1410,7 +1410,7 @@ tintervalov(PG_FUNCTION_ARGS)
 }
 
 /*
- *             tintervalstart  - returns  the start of interval i
+ *             tintervalstart  - returns  the start of tinterval i
  */
 Datum
 tintervalstart(PG_FUNCTION_ARGS)
@@ -1423,7 +1423,7 @@ tintervalstart(PG_FUNCTION_ARGS)
 }
 
 /*
- *             tintervalend            - returns  the end of interval i
+ *             tintervalend            - returns  the end of tinterval i
  */
 Datum
 tintervalend(PG_FUNCTION_ARGS)
@@ -1441,12 +1441,12 @@ tintervalend(PG_FUNCTION_ARGS)
  *****************************************************************************/
 
 /*
- *             istinterval             - returns 1, iff i_string is a valid interval descr.
- *                                                               0, iff i_string is NOT a valid interval desc.
+ *             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
  *
  *             output parameter:
- *                             i_start, i_end: interval margins
+ *                             i_start, i_end: tinterval margins
  *
  *             Time interval:
  *             `[' {` '} `'' <AbsTime> `'' {` '} `'' <AbsTime> `'' {` '} `]'
@@ -1551,7 +1551,7 @@ istinterval(char *i_string,
        c = *p;
        if (c != '\0')
                return 0;                               /* syntax error */
-       /* it seems to be a valid interval */
+       /* it seems to be a valid tinterval */
        return 1;
 }
 
index 3a22b8f72f1db66eea2d2c1a05d3dfa339e8aa28..89a97fe4ac149c66a2250109b3df9aee9103bead 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.186 2005/07/21 03:56:18 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.187 2005/07/21 04:41:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2799,14 +2799,14 @@ convert_timevalue_to_scalar(Datum value, Oid typid)
 #endif
                case TINTERVALOID:
                        {
-                               TimeInterval interval = DatumGetTimeInterval(value);
+                               TimeInterval tinterval = DatumGetTimeInterval(value);
 
 #ifdef HAVE_INT64_TIMESTAMP
-                               if (interval->status != 0)
-                                       return ((interval->data[1] - interval->data[0]) * 1000000.0);
+                               if (tinterval->status != 0)
+                                       return ((tinterval->data[1] - tinterval->data[0]) * 1000000.0);
 #else
-                               if (interval->status != 0)
-                                       return interval->data[1] - interval->data[0];
+                               if (tinterval->status != 0)
+                                       return tinterval->data[1] - tinterval->data[0];
 #endif
                                return 0;               /* for lack of a better idea */
                        }
index c7ceaff364c1e0166819443880d7379db64cb1be..0ae831448062df868685f516fd82e99cb9f00faa 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.135 2005/07/21 03:56:20 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.136 2005/07/21 04:41:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -433,7 +433,7 @@ timestamptz_recv(PG_FUNCTION_ARGS)
        /* rangecheck: see if timestamptz_out would like it */
        if (TIMESTAMP_NOT_FINITE(timestamp))
                 /* ok */ ;
-       else if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+       else if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                ereport(ERROR,
                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                 errmsg("timestamp out of range")));
@@ -1186,12 +1186,12 @@ interval2tm(Interval span, struct pg_tm *tm, fsec_t *fsec)
        time = span.time;
 
 #ifdef HAVE_INT64_TIMESTAMP
-       tm->tm_hour = (time / USECS_PER_HOUR);
-       time -= (tm->tm_hour * USECS_PER_HOUR);
-       tm->tm_min = (time / USECS_PER_MINUTE);
-       time -= (tm->tm_min * USECS_PER_MINUTE);
-       tm->tm_sec = (time / USECS_PER_SEC);
-       *fsec = (time - (tm->tm_sec * USECS_PER_SEC));
+       tm->tm_hour = time / USECS_PER_HOUR;
+       time -= tm->tm_hour * USECS_PER_HOUR;
+       tm->tm_min = time / USECS_PER_MINUTE;
+       time -= tm->tm_min * USECS_PER_MINUTE;
+       tm->tm_sec = time / USECS_PER_SEC;
+       *fsec = time - (tm->tm_sec * USECS_PER_SEC);
 #else
        TMODULO(time, tm->tm_hour, (double)SECS_PER_HOUR);
        TMODULO(time, tm->tm_min, (double)SECS_PER_MINUTE);
@@ -1883,7 +1883,7 @@ timestamp_mi(PG_FUNCTION_ARGS)
        }
        else
 #ifdef HAVE_INT64_TIMESTAMP
-               result->time = (dt1 - dt2);
+               result->time = dt1 - dt2;
 #else
                result->time = JROUND(dt1 - dt2);
 #endif
@@ -1978,7 +1978,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
                                           *tm = &tt;
                        fsec_t          fsec;
 
-                       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+                       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -1999,7 +1999,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
                        if (tm->tm_mday > day_tab[isleap(tm->tm_year)][tm->tm_mon - 1])
                                tm->tm_mday = (day_tab[isleap(tm->tm_year)][tm->tm_mon - 1]);
 
-                       if (tm2timestamp(tm, fsec, NULL, &timestamp) !=0)
+                       if (tm2timestamp(tm, fsec, NULL, &timestamp) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2012,7 +2012,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
                        fsec_t          fsec;
                        int                     julian;
                        
-                       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+                       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2021,7 +2021,7 @@ timestamp_pl_interval(PG_FUNCTION_ARGS)
                        julian = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + span->day;
                        j2date(julian, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
 
-                       if (tm2timestamp(tm, fsec, NULL, &timestamp) !=0)
+                       if (tm2timestamp(tm, fsec, NULL, &timestamp) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2079,7 +2079,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
                                           *tm = &tt;
                        fsec_t          fsec;
 
-                       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+                       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2102,7 +2102,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
 
                        tz = DetermineLocalTimeZone(tm);
 
-                       if (tm2timestamp(tm, fsec, &tz, &timestamp) !=0)
+                       if (tm2timestamp(tm, fsec, &tz, &timestamp) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2115,7 +2115,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
                        fsec_t          fsec;
                        int                     julian;
 
-                       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+                       if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2126,7 +2126,7 @@ timestamptz_pl_interval(PG_FUNCTION_ARGS)
 
                        tz = DetermineLocalTimeZone(tm);
 
-                       if (tm2timestamp(tm, fsec, &tz, &timestamp) !=0)
+                       if (tm2timestamp(tm, fsec, &tz, &timestamp) != 0)
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                 errmsg("timestamp out of range")));
@@ -2164,9 +2164,9 @@ interval_um(PG_FUNCTION_ARGS)
 
        result = (Interval *) palloc(sizeof(Interval));
 
-       result->time = -(interval->time);
-       result->day = -(interval->day);
-       result->month = -(interval->month);
+       result->time = -interval->time;
+       result->day = -interval->day;
+       result->month = -interval->month;
 
        PG_RETURN_INTERVAL_P(result);
 }
@@ -2210,10 +2210,10 @@ interval_pl(PG_FUNCTION_ARGS)
 
        result = (Interval *) palloc(sizeof(Interval));
 
-       result->month = (span1->month + span2->month);
-       result->day = (span1->day + span2->day);
+       result->month = span1->month + span2->month;
+       result->day = span1->day + span2->day;
 #ifdef HAVE_INT64_TIMESTAMP
-       result->time = (span1->time + span2->time);
+       result->time = span1->time + span2->time;
 #else
        result->time = JROUND(span1->time + span2->time);
 #endif
@@ -2230,10 +2230,10 @@ interval_mi(PG_FUNCTION_ARGS)
 
        result = (Interval *) palloc(sizeof(Interval));
 
-       result->month = (span1->month - span2->month);
-       result->day = (span1->day - span2->day);
+       result->month = span1->month - span2->month;
+       result->day = span1->day - span2->day;
 #ifdef HAVE_INT64_TIMESTAMP
-       result->time = (span1->time - span2->time);
+       result->time = span1->time - span2->time;
 #else
        result->time = JROUND(span1->time - span2->time);
 #endif
@@ -2258,12 +2258,12 @@ interval_mul(PG_FUNCTION_ARGS)
 
        result = (Interval *) palloc(sizeof(Interval));
 
-       months = (span1->month * factor);
-       days = (span1->day * factor);
+       months = span1->month * factor;
+       days = span1->day * factor;
 #ifdef HAVE_INT64_TIMESTAMP
        result->month = months;
        result->day = days;
-       result->time = (span1->time * factor);
+       result->time = span1->time * factor;
        result->time += (months - result->month) * INT64CONST(DAYS_PER_MONTH) * USECS_PER_DAY;
        result->time += (days - result->day) * INT64CONST(HOURS_PER_DAY) * USECS_PER_HOUR;
 #else
@@ -2862,7 +2862,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
 
        if (type == UNITS)
        {
-               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                         errmsg("timestamp out of range")));
@@ -2996,7 +2996,7 @@ timestamptz_trunc(PG_FUNCTION_ARGS)
 
        if (type == UNITS)
        {
-               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                         errmsg("timestamp out of range")));
@@ -3390,7 +3390,7 @@ timestamp_part(PG_FUNCTION_ARGS)
 
        if (type == UNITS)
        {
-               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                         errmsg("timestamp out of range")));
@@ -3461,7 +3461,7 @@ timestamp_part(PG_FUNCTION_ARGS)
                                 * and -1 is 11 BC thru 2 BC...
                                 */
                                if (tm->tm_year >= 0)
-                                       result = (tm->tm_year / 10);
+                                       result = tm->tm_year / 10;
                                else
                                        result = -((8 - (tm->tm_year - 1)) / 10);
                                break;
@@ -3484,7 +3484,7 @@ timestamp_part(PG_FUNCTION_ARGS)
                        case DTK_MILLENNIUM:
                                /* see comments above. */
                                if (tm->tm_year > 0)
-                                       result = ((tm->tm_year + 999) / 1000);
+                                       result = (tm->tm_year + 999) / 1000;
                                else
                                        result = -((999 - (tm->tm_year - 1)) / 1000);
                                break;
@@ -3524,7 +3524,7 @@ timestamp_part(PG_FUNCTION_ARGS)
                                         * convert to timestamptz to produce consistent
                                         * results
                                         */
-                                       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+                                       if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                                                ereport(ERROR,
                                                   (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                        errmsg("timestamp out of range")));
@@ -3544,7 +3544,7 @@ timestamp_part(PG_FUNCTION_ARGS)
                                        break;
                                }
                        case DTK_DOW:
-                               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+                               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                         errmsg("timestamp out of range")));
@@ -3552,7 +3552,7 @@ timestamp_part(PG_FUNCTION_ARGS)
                                break;
 
                        case DTK_DOY:
-                               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+                               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                         errmsg("timestamp out of range")));
@@ -3615,7 +3615,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
 
        if (type == UNITS)
        {
-               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                         errmsg("timestamp out of range")));
@@ -3696,7 +3696,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
                        case DTK_DECADE:
                                /* see comments in timestamp_part */
                                if (tm->tm_year > 0)
-                                       result = (tm->tm_year / 10);
+                                       result = tm->tm_year / 10;
                                else
                                        result = -((8 - (tm->tm_year - 1)) / 10);
                                break;
@@ -3750,7 +3750,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
                                break;
 
                        case DTK_DOW:
-                               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+                               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                         errmsg("timestamp out of range")));
@@ -3758,7 +3758,7 @@ timestamptz_part(PG_FUNCTION_ARGS)
                                break;
 
                        case DTK_DOY:
-                               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+                               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                                         errmsg("timestamp out of range")));
@@ -3868,17 +3868,17 @@ interval_part(PG_FUNCTION_ARGS)
 
                                case DTK_DECADE:
                                        /* caution: C division may have negative remainder */
-                                       result = (tm->tm_year / 10);
+                                       result = tm->tm_year / 10;
                                        break;
 
                                case DTK_CENTURY:
                                        /* caution: C division may have negative remainder */
-                                       result = (tm->tm_year / 100);
+                                       result = tm->tm_year / 100;
                                        break;
 
                                case DTK_MILLENNIUM:
                                        /* caution: C division may have negative remainder */
-                                       result = (tm->tm_year / 1000);
+                                       result = tm->tm_year / 1000;
                                        break;
 
                                default:
@@ -4025,7 +4025,7 @@ timestamp2timestamptz(Timestamp timestamp)
 
        else
        {
-               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) !=0)
+               if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) != 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                         errmsg("timestamp out of range")));
@@ -4060,7 +4060,7 @@ timestamptz_timestamp(PG_FUNCTION_ARGS)
 
        else
        {
-               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) !=0)
+               if (timestamp2tm(timestamp, &tz, tm, &fsec, &tzn, NULL) != 0)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
                                         errmsg("timestamp out of range")));
index 9b57a497a1d713169dbbe09ab356fb6f8c9777c2..3618bce1f0bf2842df44595ae8763223e7586cd3 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.128 2005/07/10 21:13:59 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.129 2005/07/21 04:41:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -455,11 +455,11 @@ textcat(PG_FUNCTION_ARGS)
        text       *result;
        char       *ptr;
 
-       len1 = (VARSIZE(t1) - VARHDRSZ);
+       len1 = VARSIZE(t1) - VARHDRSZ;
        if (len1 < 0)
                len1 = 0;
 
-       len2 = (VARSIZE(t2) - VARHDRSZ);
+       len2 = VARSIZE(t2) - VARHDRSZ;
        if (len2 < 0)
                len2 = 0;
 
@@ -756,8 +756,8 @@ text_position(text *t1, text *t2, int matchnum)
        if (VARSIZE(t2) <= VARHDRSZ)
                return 1;                               /* result for empty pattern */
 
-       len1 = (VARSIZE(t1) - VARHDRSZ);
-       len2 = (VARSIZE(t2) - VARHDRSZ);
+       len1 = VARSIZE(t1) - VARHDRSZ;
+       len2 = VARSIZE(t2) - VARHDRSZ;
 
        if (pg_database_encoding_max_length() == 1)
        {
@@ -1224,11 +1224,11 @@ byteacat(PG_FUNCTION_ARGS)
        bytea      *result;
        char       *ptr;
 
-       len1 = (VARSIZE(t1) - VARHDRSZ);
+       len1 = VARSIZE(t1) - VARHDRSZ;
        if (len1 < 0)
                len1 = 0;
 
-       len2 = (VARSIZE(t2) - VARHDRSZ);
+       len2 = VARSIZE(t2) - VARHDRSZ;
        if (len2 < 0)
                len2 = 0;
 
@@ -1349,8 +1349,8 @@ byteapos(PG_FUNCTION_ARGS)
        if (VARSIZE(t2) <= VARHDRSZ)
                PG_RETURN_INT32(1);             /* result for empty pattern */
 
-       len1 = (VARSIZE(t1) - VARHDRSZ);
-       len2 = (VARSIZE(t2) - VARHDRSZ);
+       len1 = VARSIZE(t1) - VARHDRSZ;
+       len2 = VARSIZE(t2) - VARHDRSZ;
 
        p1 = VARDATA(t1);
        p2 = VARDATA(t2);