mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Remove un-needed braces around single statements.
This commit is contained in:
@@ -895,9 +895,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ECPGfinish(con);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -291,9 +291,7 @@ ECPGdump_a_struct(FILE *o, const char *name, const char * ind_name, long arrsiz,
|
||||
offset = obuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = offsetarg;
|
||||
}
|
||||
|
||||
sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
|
||||
prefix = pbuf;
|
||||
@@ -349,9 +347,7 @@ ECPGfree_type(struct ECPGtype * typ)
|
||||
free(typ->u.members);
|
||||
}
|
||||
else
|
||||
{
|
||||
abort();
|
||||
}
|
||||
}
|
||||
free(typ);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.23 1998/03/30 17:39:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.24 1998/06/15 19:30:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -62,13 +62,9 @@ translate_escape(char *p, int isArray)
|
||||
case '7':
|
||||
c = DIGIT(c);
|
||||
if (ISOCTAL(*s))
|
||||
{
|
||||
c = (c << 3) + DIGIT(*s++);
|
||||
}
|
||||
if (ISOCTAL(*s))
|
||||
{
|
||||
c = (c << 3) + DIGIT(*s++);
|
||||
}
|
||||
*p = c;
|
||||
break;
|
||||
case 'b':
|
||||
@@ -102,13 +98,9 @@ translate_escape(char *p, int isArray)
|
||||
* the caller.
|
||||
*/
|
||||
if (isArray)
|
||||
{
|
||||
return p + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = c;
|
||||
}
|
||||
break;
|
||||
case '\0':
|
||||
|
||||
@@ -132,9 +124,7 @@ translate_escape(char *p, int isArray)
|
||||
/* Shift the rest of the buffer over itself after the current char */
|
||||
q = p + 1;
|
||||
for (; *s;)
|
||||
{
|
||||
*q++ = *s++;
|
||||
}
|
||||
*q = '\0';
|
||||
#ifdef TCL_ARRAYS_DEBUG_ESCAPE
|
||||
printf(" after = '%s'\n", p);
|
||||
@@ -158,9 +148,7 @@ tcl_value(char *value)
|
||||
char *p;
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return ((char *) NULL);
|
||||
}
|
||||
|
||||
#ifdef TCL_ARRAYS_DEBUG
|
||||
printf("pq_value = '%s'\n", value);
|
||||
@@ -206,9 +194,7 @@ tcl_value(char *value)
|
||||
}
|
||||
}
|
||||
if (!*p)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -225,9 +211,7 @@ tcl_value(char *value)
|
||||
p = translate_escape(p, 0);
|
||||
}
|
||||
if (!*p)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef TCL_ARRAYS_DEBUG
|
||||
@@ -1236,9 +1220,7 @@ Pg_select(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
|
||||
Tcl_SetVar2(interp, argv[3], ".tupno", buffer, 0);
|
||||
|
||||
for (column = 0; column < ncols; column++)
|
||||
{
|
||||
Tcl_SetVar2(interp, argv[3], info[column].cname, PQgetvalue(result, tupno, column), 0);
|
||||
}
|
||||
|
||||
Tcl_SetVar2(interp, argv[3], ".command", "update", 0);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.16 1998/03/22 04:18:17 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.17 1998/06/15 19:30:22 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -396,9 +396,7 @@ pg_krb5_sendauth(const char *PQerrormsg, int sock,
|
||||
strcpy(servbuf, PG_KRB_SRVNAM);
|
||||
*(hostp = servbuf + (sizeof(PG_KRB_SRVNAM) - 1)) = '/';
|
||||
if (hostname || *hostname)
|
||||
{
|
||||
strncpy(++hostp, hostname, MAXHOSTNAMELEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gethostname(++hostp, MAXHOSTNAMELEN) < 0)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.66 1998/05/06 23:51:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.67 1998/06/15 19:30:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -328,17 +328,11 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, cons
|
||||
conn->pgoptions = strdup(pgoptions);
|
||||
|
||||
if (login)
|
||||
{
|
||||
conn->pguser = strdup(login);
|
||||
}
|
||||
else if ((tmp = getenv("PGUSER")) != NULL)
|
||||
{
|
||||
conn->pguser = strdup(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
conn->pguser = fe_getauthname(conn->errorMessage);
|
||||
}
|
||||
|
||||
if (conn->pguser == NULL)
|
||||
{
|
||||
@@ -348,17 +342,11 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, cons
|
||||
}
|
||||
|
||||
if (pwd)
|
||||
{
|
||||
conn->pgpass = strdup(pwd);
|
||||
}
|
||||
else if ((tmp = getenv("PGPASSWORD")) != NULL)
|
||||
{
|
||||
conn->pgpass = strdup(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
conn->pgpass = strdup(DefaultPassword);
|
||||
}
|
||||
|
||||
if ((dbName == NULL) || dbName[0] == '\0')
|
||||
{
|
||||
@@ -465,9 +453,7 @@ connectDB(PGconn *conn)
|
||||
len = sizeof(struct sockaddr_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = UNIXSOCK_PATH(conn->raddr.un, portno);
|
||||
}
|
||||
|
||||
/* Connect to the server */
|
||||
if ((conn->sock = socket(family, SOCK_STREAM, 0)) < 0)
|
||||
@@ -846,9 +832,7 @@ void
|
||||
PQfinish(PGconn *conn)
|
||||
{
|
||||
if (!conn)
|
||||
{
|
||||
fprintf(stderr, "PQfinish() -- pointer to PGconn is null\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
closePGconn(conn);
|
||||
@@ -864,9 +848,7 @@ void
|
||||
PQreset(PGconn *conn)
|
||||
{
|
||||
if (!conn)
|
||||
{
|
||||
fprintf(stderr, "PQreset() -- pointer to PGconn is null\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
closePGconn(conn);
|
||||
@@ -941,18 +923,14 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
while (*cp)
|
||||
{
|
||||
if (*cp == '=')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (isspace(*cp))
|
||||
{
|
||||
*cp++ = '\0';
|
||||
while (*cp)
|
||||
{
|
||||
if (!isspace(*cp))
|
||||
{
|
||||
break;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
break;
|
||||
@@ -975,9 +953,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
while (*cp)
|
||||
{
|
||||
if (!isspace(*cp))
|
||||
{
|
||||
break;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
|
||||
@@ -997,14 +973,10 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
{
|
||||
cp++;
|
||||
if (*cp != '\0')
|
||||
{
|
||||
*cp2++ = *cp++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*cp2++ = *cp++;
|
||||
}
|
||||
}
|
||||
*cp2 = '\0';
|
||||
}
|
||||
@@ -1025,9 +997,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
{
|
||||
cp++;
|
||||
if (*cp != '\0')
|
||||
{
|
||||
*cp2++ = *cp++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (*cp == '\'')
|
||||
@@ -1048,9 +1018,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
for (option = PQconninfoOptions; option->keyword != NULL; option++)
|
||||
{
|
||||
if (!strcmp(option->keyword, pname))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (option->keyword == NULL)
|
||||
{
|
||||
@@ -1112,9 +1080,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
{
|
||||
tmp = fe_getauthname(errortmp);
|
||||
if (tmp)
|
||||
{
|
||||
option->val = strdup(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------
|
||||
@@ -1125,9 +1091,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
|
||||
{
|
||||
tmp = conninfo_getval("user");
|
||||
if (tmp)
|
||||
{
|
||||
option->val = strdup(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1143,9 +1107,7 @@ conninfo_getval(char *keyword)
|
||||
for (option = PQconninfoOptions; option->keyword != NULL; option++)
|
||||
{
|
||||
if (!strcmp(option->keyword, keyword))
|
||||
{
|
||||
return option->val;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1273,9 +1235,7 @@ PQtrace(PGconn *conn, FILE *debug_port)
|
||||
{
|
||||
if (conn == NULL ||
|
||||
conn->status == CONNECTION_BAD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
PQuntrace(conn);
|
||||
conn->Pfdebug = debug_port;
|
||||
}
|
||||
@@ -1285,9 +1245,7 @@ PQuntrace(PGconn *conn)
|
||||
{
|
||||
/* note: better allow untrace even when connection bad */
|
||||
if (conn == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (conn->Pfdebug)
|
||||
{
|
||||
fflush(conn->Pfdebug);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.52 1998/05/14 17:18:14 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.53 1998/06/15 19:30:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -258,9 +258,7 @@ PQconsumeInput(PGconn *conn)
|
||||
* Note that we will NOT block waiting for more input.
|
||||
*/
|
||||
if (pqReadData(conn) < 0)
|
||||
{
|
||||
strcpy(conn->asyncErrorMessage, conn->errorMessage);
|
||||
}
|
||||
/* Parsing of the data waits till later. */
|
||||
}
|
||||
|
||||
@@ -580,9 +578,7 @@ getAnotherTuple(PGconn *conn, int binary)
|
||||
if (pqGetInt(&vlen, 4, conn))
|
||||
return EOF;
|
||||
if (binary == 0)
|
||||
{
|
||||
vlen = vlen - 4;
|
||||
}
|
||||
if (vlen < 0)
|
||||
vlen = 0;
|
||||
if (tup[i].value == NULL)
|
||||
@@ -950,9 +946,7 @@ void
|
||||
PQputline(PGconn *conn, const char *s)
|
||||
{
|
||||
if (conn && conn->sock >= 0)
|
||||
{
|
||||
(void) pqPutnchar(s, strlen(s), conn);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1237,9 +1231,7 @@ PQfname(PGresult *res, int field_num)
|
||||
return NULL;
|
||||
}
|
||||
if (res->attDescs)
|
||||
{
|
||||
return res->attDescs[field_num].name;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -1304,9 +1296,7 @@ PQftype(PGresult *res, int field_num)
|
||||
return InvalidOid;
|
||||
}
|
||||
if (res->attDescs)
|
||||
{
|
||||
return res->attDescs[field_num].adtid;
|
||||
}
|
||||
else
|
||||
return InvalidOid;
|
||||
}
|
||||
@@ -1328,9 +1318,7 @@ PQfsize(PGresult *res, int field_num)
|
||||
return 0;
|
||||
}
|
||||
if (res->attDescs)
|
||||
{
|
||||
return res->attDescs[field_num].adtsize;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -1352,9 +1340,7 @@ PQfmod(PGresult *res, int field_num)
|
||||
return 0;
|
||||
}
|
||||
if (res->attDescs)
|
||||
{
|
||||
return res->attDescs[field_num].adtmod;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.12 1998/05/12 21:44:03 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.13 1998/06/15 19:30:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -51,9 +51,7 @@ lo_open(PGconn *conn, Oid lobjId, int mode)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
res = PQfn(conn, conn->lobjfuncs->fn_lo_open, &fd, &result_len, 1, argv, 2);
|
||||
@@ -89,9 +87,7 @@ lo_close(PGconn *conn, int fd)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
argv[0].isint = 1;
|
||||
@@ -126,9 +122,7 @@ lo_read(PGconn *conn, int fd, char *buf, int len)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
argv[0].isint = 1;
|
||||
@@ -166,9 +160,7 @@ lo_write(PGconn *conn, int fd, char *buf, int len)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (len <= 0)
|
||||
@@ -211,9 +203,7 @@ lo_lseek(PGconn *conn, int fd, int offset, int whence)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
argv[0].isint = 1;
|
||||
@@ -259,9 +249,7 @@ lo_creat(PGconn *conn, int mode)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
argv[0].isint = 1;
|
||||
@@ -296,9 +284,7 @@ lo_tell(PGconn *conn, int fd)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
argv[0].isint = 1;
|
||||
@@ -333,9 +319,7 @@ lo_unlink(PGconn *conn, Oid lobjId)
|
||||
if (conn->lobjfuncs == (PGlobjfuncs *) NULL)
|
||||
{
|
||||
if (lo_initialize(conn) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
argv[0].isint = 1;
|
||||
@@ -546,37 +530,21 @@ lo_initialize(PGconn *conn)
|
||||
fname = PQgetvalue(res, n, 0);
|
||||
foid = (Oid) atoi(PQgetvalue(res, n, 1));
|
||||
if (!strcmp(fname, "lo_open"))
|
||||
{
|
||||
lobjfuncs->fn_lo_open = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "lo_close"))
|
||||
{
|
||||
lobjfuncs->fn_lo_close = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "lo_creat"))
|
||||
{
|
||||
lobjfuncs->fn_lo_creat = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "lo_unlink"))
|
||||
{
|
||||
lobjfuncs->fn_lo_unlink = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "lo_lseek"))
|
||||
{
|
||||
lobjfuncs->fn_lo_lseek = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "lo_tell"))
|
||||
{
|
||||
lobjfuncs->fn_lo_tell = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "loread"))
|
||||
{
|
||||
lobjfuncs->fn_lo_read = foid;
|
||||
}
|
||||
else if (!strcmp(fname, "lowrite"))
|
||||
{
|
||||
lobjfuncs->fn_lo_write = foid;
|
||||
}
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.14 1998/05/12 15:42:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.15 1998/06/15 19:30:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -316,9 +316,7 @@ pqReadData(PGconn *conn)
|
||||
conn->inStart = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
conn->inStart = conn->inCursor = conn->inEnd = 0;
|
||||
}
|
||||
/* If the buffer is fairly full, enlarge it.
|
||||
* We need to be able to enlarge the buffer in case a single message
|
||||
* exceeds the initial buffer size. We enlarge before filling the
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* didn't really belong there.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.2 1998/05/07 16:17:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.3 1998/06/15 19:30:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -327,9 +327,7 @@ PQdisplayTuples(PGresult *res,
|
||||
|
||||
/* Zero the initial field lengths */
|
||||
for (j = 0; j < nFields; j++)
|
||||
{
|
||||
fLength[j] = strlen(PQfname(res, j));
|
||||
}
|
||||
/* Find the max length of each field in the result */
|
||||
/* will be somewhat time consuming for very large results */
|
||||
if (fillAlign)
|
||||
@@ -415,9 +413,7 @@ PQprintTuples(PGresult *res,
|
||||
nTups = PQntuples(res);
|
||||
|
||||
if (colWidth > 0)
|
||||
{
|
||||
sprintf(formatString, "%%s %%-%ds", colWidth);
|
||||
}
|
||||
else
|
||||
sprintf(formatString, "%%s %%s");
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.5 1997/09/08 02:40:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.6 1998/06/15 19:30:26 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This shouldn't be in libpq, but the monitor and some other
|
||||
@@ -35,9 +35,7 @@ pqsignal(int signo, pqsigfunc func)
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
if (signo != SIGALRM)
|
||||
{
|
||||
act.sa_flags |= SA_RESTART;
|
||||
}
|
||||
if (sigaction(signo, &act, &oact) < 0)
|
||||
return (SIG_ERR);
|
||||
return (oact.sa_handler);
|
||||
|
||||
Reference in New Issue
Block a user