1
0
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:
Bruce Momjian
1998-06-15 19:30:31 +00:00
parent 27db9ecd0b
commit 6bd323c6b3
224 changed files with 221 additions and 2504 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.41 1998/02/26 04:32:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.42 1998/06/15 19:28:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,9 +45,7 @@ listCopy(List *list)
foreach(l, list)
{
if (newlist == NIL)
{
newlist = nl = lcons(lfirst(l), NIL);
}
else
{
lnext(nl) = lcons(lfirst(l), NIL);
@@ -842,9 +840,7 @@ _copyConst(Const *from)
}
}
else
{
newnode->constvalue = from->constvalue;
}
newnode->constisnull = from->constisnull;
newnode->constbyval = from->constbyval;
newnode->constisset = from->constisset;
@@ -1108,9 +1104,7 @@ CopyPathFields(Path *from, Path *newnode)
}
}
else
{
Node_Copy(from, newnode, p_ordering.ord.merge);
}
Node_Copy(from, newnode, keys);
@@ -1829,9 +1823,7 @@ copyObject(void *from)
foreach(l, list)
{
if (newlist == NIL)
{
newlist = nl = lcons(copyObject(lfirst(l)), NIL);
}
else
{
lnext(nl) = lcons(copyObject(lfirst(l)), NIL);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.12 1998/02/26 04:32:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.13 1998/06/15 19:28:31 momjian Exp $
*
* NOTES
* XXX a few of the following functions are duplicated to handle
@@ -122,9 +122,7 @@ nreverse(List *list)
return (list);
for (p = list; p != NULL; p = lnext(p))
{
rlist = lcons(lfirst(p), rlist);
}
lfirst(list) = lfirst(rlist);
lnext(list) = lnext(rlist);
@@ -324,9 +322,7 @@ LispUnion(List *l1, List *l2)
}
}
foreach(i, l2)
{
retval = lappend(retval, lfirst(i));
}
return (retval);
}
@@ -356,9 +352,7 @@ LispUnioni(List *l1, List *l2)
}
}
foreach(i, l2)
{
retval = lappendi(retval, lfirsti(i));
}
return (retval);
}
@@ -410,13 +404,9 @@ lremove(void *elem, List *list)
if (l != NULL)
{
if (prev == NIL)
{
result = lnext(list);
}
else
{
lnext(prev) = lnext(l);
}
}
return result;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.35 1998/05/09 23:46:35 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.36 1998/06/15 19:28:32 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -690,9 +690,7 @@ _outFjoin(StringInfo str, Fjoin *node)
appendStringInfo(str, " :alwaysdone ");
for (i = 0; i < node->fj_nNodes; i++)
{
appendStringInfo(str, (node->fj_alwaysDone[i]) ? "true" : "false");
}
}
/*
@@ -779,13 +777,9 @@ _outConst(StringInfo str, Const *node)
appendStringInfo(str, node->constisnull ? "true" : "false");
appendStringInfo(str, " :constvalue ");
if (node->constisnull)
{
appendStringInfo(str, "<>");
}
else
{
_outDatum(str, node->constvalue, node->consttype);
}
appendStringInfo(str, " :constbyval ");
appendStringInfo(str, node->constbyval ? "true" : "false");
}
@@ -1496,9 +1490,7 @@ _outDatum(StringInfo str, Datum value, Oid type)
* without casting it to int first!! -mer 8 Jan 1991
*/
if (((int) length) <= -1)
{
length = VARSIZE(s);
}
sprintf(buf, " %d [ ", length);
appendStringInfo(str, buf);
for (i = 0; i < length; i++)

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.14 1998/01/20 05:03:54 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.15 1998/06/15 19:28:32 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -69,9 +69,7 @@ pprint(void *obj)
for (;;)
{
for (j = 0; j < indentLev * 3; j++)
{
line[j] = ' ';
}
for (; j < 75 && s[i] != '\0'; i++, j++)
{
line[j] = s[i];
@@ -109,9 +107,7 @@ pprint(void *obj)
printf("%s\n", line);
/* print the line before : and resets */
for (j = 0; j < indentLev * 3; j++)
{
line[j] = ' ';
}
}
line[j] = s[i];
break;
@@ -123,9 +119,7 @@ pprint(void *obj)
printf("%s\n", line);
}
if (j != 0)
{
printf("%s\n", line);
}
fflush(stdout);
return;
}
@@ -211,14 +205,10 @@ print_expr(Node *expr, List *rtable)
print_expr((Node *) get_rightop(e), rtable);
}
else
{
printf("an expr");
}
}
else
{
printf("not an expr");
}
}
/*
@@ -258,13 +248,9 @@ print_tl(List *tlist, List *rtable)
printf("\t%d %s\t", tle->resdom->resno, tle->resdom->resname);
if (tle->resdom->reskey != 0)
{
printf("(%d):\t", tle->resdom->reskey);
}
else
{
printf(" :\t");
}
print_expr(tle->expr, rtable);
printf("\n");
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.11 1998/02/26 04:32:16 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.12 1998/06/15 19:28:32 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -78,9 +78,7 @@ nodeTokenType(char *token, int length)
* skip the optional '-' (i.e. negative number)
*/
if (*token == '-')
{
token++;
}
/*
* See if there is a decimal point
@@ -127,9 +125,7 @@ lsptok(char *string, int *length)
{
local_str = string;
if (length == NULL)
{
return (NULL);
}
}
for (; *local_str == ' '
@@ -159,9 +155,7 @@ lsptok(char *string, int *length)
}
else if (*local_str == ')' || *local_str == '(' ||
*local_str == '}' || *local_str == '{')
{
local_str++;
}
else
{
for (; *local_str != ' '
@@ -223,9 +217,7 @@ nodeRead(bool read_car_only)
this_value = (Node *) l;
}
else
{
this_value = nodeRead(false);
}
break;
case RIGHT_PAREN:
this_value = NULL;
@@ -241,13 +233,9 @@ nodeRead(bool read_car_only)
* It might be NULL but it is an atom!
*/
if (read_car_only)
{
make_dotted_pair_cell = false;
}
else
{
make_dotted_pair_cell = true;
}
}
else
{
@@ -293,18 +281,12 @@ nodeRead(bool read_car_only)
lfirst(l) = this_value;
if (!read_car_only)
{
lnext(l) = nodeRead(false);
}
else
{
lnext(l) = NULL;
}
return_value = (Node *) l;
}
else
{
return_value = this_value;
}
return (return_value);
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.29 1998/04/27 02:58:07 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.30 1998/06/15 19:28:33 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -238,9 +238,7 @@ _getPlan(Plan *node)
token = lsptok(NULL, &length); /* now get the state */
if (length == 0)
{
node->state = (EState *) NULL;
}
else
{ /* Disgusting hack until I figure out what
* to do here */
@@ -758,29 +756,17 @@ _readExpr()
token = lsptok(NULL, &length); /* eat :opType */
token = lsptok(NULL, &length); /* get opType */
if (!strncmp(token, "op", 2))
{
local_node->opType = OP_EXPR;
}
else if (!strncmp(token, "func", 4))
{
local_node->opType = FUNC_EXPR;
}
else if (!strncmp(token, "or", 2))
{
local_node->opType = OR_EXPR;
}
else if (!strncmp(token, "and", 3))
{
local_node->opType = AND_EXPR;
}
else if (!strncmp(token, "not", 3))
{
local_node->opType = NOT_EXPR;
}
else if (!strncmp(token, "subp", 4))
{
local_node->opType = SUBPLAN_EXPR;
}
token = lsptok(NULL, &length); /* eat :oper */
local_node->oper = nodeRead(true);
@@ -953,13 +939,9 @@ _readConst()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->constisnull = true;
}
else
{
local_node->constisnull = false;
}
token = lsptok(NULL, &length); /* get :constvalue */
@@ -981,13 +963,9 @@ _readConst()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->constbyval = true;
}
else
{
local_node->constbyval = false;
}
return (local_node);
}
@@ -1019,13 +997,9 @@ _readFunc()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->funcisindex = true;
}
else
{
local_node->funcisindex = false;
}
token = lsptok(NULL, &length); /* get :funcsize */
token = lsptok(NULL, &length); /* now read it */
@@ -1264,13 +1238,9 @@ _readRel()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->indexed = true;
}
else
{
local_node->indexed = false;
}
token = lsptok(NULL, &length); /* get :pages */
token = lsptok(NULL, &length); /* now read it */
@@ -1817,13 +1787,9 @@ _readCInfo()
token = lsptok(NULL, &length); /* now read it */
if (!strncmp(token, "true", 4))
{
local_node->notclause = true;
}
else
{
local_node->notclause = false;
}
token = lsptok(NULL, &length); /* get :indexids */
local_node->indexids = nodeRead(true); /* now read it */
@@ -1917,24 +1883,16 @@ _readJInfo()
token = lsptok(NULL, &length); /* get :mergesortable */
if (!strncmp(token, "true", 4))
{
local_node->mergesortable = true;
}
else
{
local_node->mergesortable = false;
}
token = lsptok(NULL, &length); /* get :hashjoinable */
if (!strncmp(token, "true", 4))
{
local_node->hashjoinable = true;
}
else
{
local_node->hashjoinable = false;
}
return (local_node);
}
@@ -1979,193 +1937,99 @@ parsePlanString(void)
token = lsptok(NULL, &length);
if (!strncmp(token, "PLAN", length))
{
return_value = _readPlan();
}
else if (!strncmp(token, "RESULT", length))
{
return_value = _readResult();
}
else if (!strncmp(token, "APPEND", length))
{
return_value = _readAppend();
}
else if (!strncmp(token, "JOIN", length))
{
return_value = _readJoin();
}
else if (!strncmp(token, "NESTLOOP", length))
{
return_value = _readNestLoop();
}
else if (!strncmp(token, "MERGEJOIN", length))
{
return_value = _readMergeJoin();
}
else if (!strncmp(token, "HASHJOIN", length))
{
return_value = _readHashJoin();
}
else if (!strncmp(token, "SCAN", length))
{
return_value = _readScan();
}
else if (!strncmp(token, "SEQSCAN", length))
{
return_value = _readSeqScan();
}
else if (!strncmp(token, "INDEXSCAN", length))
{
return_value = _readIndexScan();
}
else if (!strncmp(token, "TEMP", length))
{
return_value = _readTemp();
}
else if (!strncmp(token, "SORT", length))
{
return_value = _readSort();
}
else if (!strncmp(token, "AGGREG", length))
{
return_value = _readAggreg();
}
else if (!strncmp(token, "SUBLINK", length))
{
return_value = _readSubLink();
}
else if (!strncmp(token, "AGG", length))
{
return_value = _readAgg();
}
else if (!strncmp(token, "UNIQUE", length))
{
return_value = _readUnique();
}
else if (!strncmp(token, "HASH", length))
{
return_value = _readHash();
}
else if (!strncmp(token, "RESDOM", length))
{
return_value = _readResdom();
}
else if (!strncmp(token, "EXPR", length))
{
return_value = _readExpr();
}
else if (!strncmp(token, "ARRAYREF", length))
{
return_value = _readArrayRef();
}
else if (!strncmp(token, "ARRAY", length))
{
return_value = _readArray();
}
else if (!strncmp(token, "VAR", length))
{
return_value = _readVar();
}
else if (!strncmp(token, "CONST", length))
{
return_value = _readConst();
}
else if (!strncmp(token, "FUNC", length))
{
return_value = _readFunc();
}
else if (!strncmp(token, "OPER", length))
{
return_value = _readOper();
}
else if (!strncmp(token, "PARAM", length))
{
return_value = _readParam();
}
else if (!strncmp(token, "ESTATE", length))
{
return_value = _readEState();
}
else if (!strncmp(token, "REL", length))
{
return_value = _readRel();
}
else if (!strncmp(token, "TLE", length))
{
return_value = _readTargetEntry();
}
else if (!strncmp(token, "RTE", length))
{
return_value = _readRangeTblEntry();
}
else if (!strncmp(token, "PATH", length))
{
return_value = _readPath();
}
else if (!strncmp(token, "INDEXPATH", length))
{
return_value = _readIndexPath();
}
else if (!strncmp(token, "JOINPATH", length))
{
return_value = _readJoinPath();
}
else if (!strncmp(token, "MERGEPATH", length))
{
return_value = _readMergePath();
}
else if (!strncmp(token, "HASHPATH", length))
{
return_value = _readHashPath();
}
else if (!strncmp(token, "ORDERKEY", length))
{
return_value = _readOrderKey();
}
else if (!strncmp(token, "JOINKEY", length))
{
return_value = _readJoinKey();
}
else if (!strncmp(token, "MERGEORDER", length))
{
return_value = _readMergeOrder();
}
else if (!strncmp(token, "CINFO", length))
{
return_value = _readCInfo();
}
else if (!strncmp(token, "JOINMETHOD", length))
{
return_value = _readJoinMethod();
}
else if (!strncmp(token, "JINFO", length))
{
return_value = _readJInfo();
}
else if (!strncmp(token, "HINFO", length))
{
return_value = _readHInfo();
}
else if (!strncmp(token, "ITER", length))
{
return_value = _readIter();
}
else if (!strncmp(token, "QUERY", length))
{
return_value = _readQuery();
}
else if (!strncmp(token, "SORTCLAUSE", length))
{
return_value = _readSortClause();
}
else if (!strncmp(token, "GROUPCLAUSE", length))
{
return_value = _readGroupClause();
}
else
{
elog(ERROR, "badly formatted planstring \"%.10s\"...\n", token);
}
return ((Node *) return_value);
}
@@ -2202,9 +2066,7 @@ readDatum(Oid type)
if (byValue)
{
if (length > sizeof(Datum))
{
elog(ERROR, "readValue: byval & length = %d", length);
}
s = (char *) (&res);
for (i = 0; i < sizeof(Datum); i++)
{
@@ -2213,9 +2075,7 @@ readDatum(Oid type)
}
}
else if (length <= 0)
{
s = NULL;
}
else if (length >= 1)
{
s = (char *) palloc(length);
@@ -2230,9 +2090,7 @@ readDatum(Oid type)
token = lsptok(NULL, &tokenLength); /* skip the ']' */
if (token[0] != ']')
{
elog(ERROR, "readValue: ']' expected, length =%d", length);
}
return (res);
}