Commit 9dbd00b0 authored by Bruce Momjian's avatar Bruce Momjian

Remove unnecessary parentheses in assignments.

Add spaces where needed.
Reference time interval variables as tinterval.
parent 3976899f
......@@ -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;
}
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
This diff is collapsed.
......@@ -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 */
}
......
This diff is collapsed.
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment