diff options
| author | Bruce Momjian | 1998-06-15 19:30:31 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1998-06-15 19:30:31 +0000 |
| commit | 6bd323c6b3f65b26273d5efb7ddd0ac04d039546 (patch) | |
| tree | 6106db4e7512e765ca8c48963fb750cb63fec96f /src/interfaces/libpq | |
| parent | 27db9ecd0b15abca733a99dab3bf9771ad70507d (diff) | |
Remove un-needed braces around single statements.
Diffstat (limited to 'src/interfaces/libpq')
| -rw-r--r-- | src/interfaces/libpq/fe-auth.c | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-connect.c | 44 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-exec.c | 16 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-lobj.c | 34 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-misc.c | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-print.c | 6 | ||||
| -rw-r--r-- | src/interfaces/libpq/pqsignal.c | 4 |
7 files changed, 7 insertions, 105 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 148d9343497..a5d842d905d 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -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) diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 288f159c740..20c02950b1d 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -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); diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index c48e9aa9b15..8b4a55e290e 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -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; } diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 126a704b32c..d18a4d53c15 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -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); diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index bbe112d2ef7..e79460798d9 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -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 diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index 5b86f950959..493b37d0a3e 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -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"); diff --git a/src/interfaces/libpq/pqsignal.c b/src/interfaces/libpq/pqsignal.c index 3a43271be0d..815c00f343d 100644 --- a/src/interfaces/libpq/pqsignal.c +++ b/src/interfaces/libpq/pqsignal.c @@ -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); |
