diff options
author | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
commit | f99a569a2ee3763b4ae174e81250c95ca0fdcbb6 (patch) | |
tree | 76e6371fe8b347c73d7020c0bc54b9fba519dc10 /src/interfaces/libpq | |
parent | 451e419e9852cdf9d7e7cefc09d5355abb3405e9 (diff) | |
download | postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.tar.gz postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.zip |
pgindent run for 8.2.
Diffstat (limited to 'src/interfaces/libpq')
-rw-r--r-- | src/interfaces/libpq/fe-auth.c | 38 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 97 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-exec.c | 61 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-lobj.c | 20 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-print.c | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-protocol3.c | 65 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 12 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 11 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/win32.c | 2 |
11 files changed, 173 insertions, 145 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index bcc4c570bf5..7725f52f354 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -10,7 +10,7 @@ * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes). * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.120 2006/09/22 21:39:58 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.121 2006/10/04 00:30:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -100,7 +100,7 @@ pg_an_to_ln(char *aname) * Various krb5 state which is not connection specific, and a flag to * indicate whether we have initialised it yet. */ -/* +/* static int pg_krb5_initialised; static krb5_context pg_krb5_context; static krb5_ccache pg_krb5_ccache; @@ -110,16 +110,16 @@ static char *pg_krb5_name; struct krb5_info { - int pg_krb5_initialised; - krb5_context pg_krb5_context; - krb5_ccache pg_krb5_ccache; - krb5_principal pg_krb5_client; - char *pg_krb5_name; + int pg_krb5_initialised; + krb5_context pg_krb5_context; + krb5_ccache pg_krb5_ccache; + krb5_principal pg_krb5_client; + char *pg_krb5_name; }; static int -pg_krb5_init(char *PQerrormsg, struct krb5_info *info) +pg_krb5_init(char *PQerrormsg, struct krb5_info * info) { krb5_error_code retval; @@ -175,8 +175,8 @@ pg_krb5_init(char *PQerrormsg, struct krb5_info *info) return STATUS_OK; } -static void -pg_krb5_destroy(struct krb5_info *info) +static void +pg_krb5_destroy(struct krb5_info * info) { krb5_free_principal(info->pg_krb5_context, info->pg_krb5_client); krb5_cc_close(info->pg_krb5_context, info->pg_krb5_ccache); @@ -193,8 +193,9 @@ pg_krb5_destroy(struct krb5_info *info) static char * pg_krb5_authname(char *PQerrormsg) { - char *tmp_name; + char *tmp_name; struct krb5_info info; + info.pg_krb5_initialised = 0; if (pg_krb5_init(PQerrormsg, &info) != STATUS_OK) @@ -219,6 +220,7 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, const char *hostname, const char *s krb5_auth_context auth_context = NULL; krb5_error *err_ret = NULL; struct krb5_info info; + info.pg_krb5_initialised = 0; if (!hostname) @@ -519,7 +521,7 @@ char * pg_fe_getauthname(char *PQerrormsg) { #ifdef KRB5 - char *krb5_name = NULL; + char *krb5_name = NULL; #endif const char *name = NULL; char *authn; @@ -545,10 +547,12 @@ pg_fe_getauthname(char *PQerrormsg) pglock_thread(); #ifdef KRB5 - /* pg_krb5_authname gives us a strdup'd value that we need - * to free later, however, we don't want to free 'name' directly - * in case it's *not* a Kerberos login and we fall through to - * name = pw->pw_name; */ + + /* + * pg_krb5_authname gives us a strdup'd value that we need to free later, + * however, we don't want to free 'name' directly in case it's *not* a + * Kerberos login and we fall through to name = pw->pw_name; + */ krb5_name = pg_krb5_authname(PQerrormsg); name = krb5_name; #endif @@ -583,7 +587,7 @@ pg_fe_getauthname(char *PQerrormsg) * * This is intended to be used by client applications that wish to send * commands like ALTER USER joe PASSWORD 'pwd'. The password need not - * be sent in cleartext if it is encrypted on the client side. This is + * be sent in cleartext if it is encrypted on the client side. This is * good because it ensures the cleartext password won't end up in logs, * pg_stat displays, etc. We export the function so that clients won't * be dependent on low-level details like whether the enceyption is MD5 diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 0dca43803f1..fd08023aae7 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.336 2006/09/27 15:41:24 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.337 2006/10/04 00:30:12 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -66,7 +66,7 @@ typedef struct timeval LDAP_TIMEVAL; #endif static int ldapServiceLookup(const char *purl, PQconninfoOption *options, - PQExpBuffer errorMessage); + PQExpBuffer errorMessage); #endif #include "libpq/ip.h" @@ -513,9 +513,9 @@ connectOptions2(PGconn *conn) conn->sslmode = strdup(DefaultSSLMode); /* - * Only if we get this far is it appropriate to try to connect. - * (We need a state flag, rather than just the boolean result of - * this function, in case someone tries to PQreset() the PGconn.) + * Only if we get this far is it appropriate to try to connect. (We need a + * state flag, rather than just the boolean result of this function, in + * case someone tries to PQreset() the PGconn.) */ conn->options_valid = true; @@ -2385,13 +2385,31 @@ static int ldapServiceLookup(const char *purl, PQconninfoOption *options, PQExpBuffer errorMessage) { - int port = LDAP_DEF_PORT, scope, rc, msgid, size, state, oldstate, i; + int port = LDAP_DEF_PORT, + scope, + rc, + msgid, + size, + state, + oldstate, + i; bool found_keyword; - char *url, *hostname, *portstr, *endptr, *dn, *scopestr, *filter, - *result, *p, *p1 = NULL, *optname = NULL, *optval = NULL; + char *url, + *hostname, + *portstr, + *endptr, + *dn, + *scopestr, + *filter, + *result, + *p, + *p1 = NULL, + *optname = NULL, + *optval = NULL; char *attrs[2] = {NULL, NULL}; LDAP *ld = NULL; - LDAPMessage *res, *entry; + LDAPMessage *res, + *entry; struct berval **values; LDAP_TIMEVAL time = {PGLDAP_TIMEOUT, 0}; @@ -2402,9 +2420,9 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, } /* - * Parse URL components, check for correctness. Basically, url has - * '\0' placed at component boundaries and variables are pointed - * at each component. + * Parse URL components, check for correctness. Basically, url has '\0' + * placed at component boundaries and variables are pointed at each + * component. */ if (pg_strncasecmp(url, LDAP_URL, strlen(LDAP_URL)) != 0) @@ -2417,26 +2435,26 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, /* hostname */ hostname = url + strlen(LDAP_URL); - if (*hostname == '/') /* no hostname? */ - hostname = "localhost"; /* the default */ + if (*hostname == '/') /* no hostname? */ + hostname = "localhost"; /* the default */ /* dn, "distinguished name" */ - p = strchr(url + strlen(LDAP_URL), '/'); + p = strchr(url + strlen(LDAP_URL), '/'); if (p == NULL || *(p + 1) == '\0' || *(p + 1) == '?') { printfPQExpBuffer(errorMessage, libpq_gettext( - "bad LDAP URL \"%s\": missing distinguished name\n"), purl); + "bad LDAP URL \"%s\": missing distinguished name\n"), purl); free(url); return 3; } - *p = '\0'; /* terminate hostname */ + *p = '\0'; /* terminate hostname */ dn = p + 1; /* attribute */ if ((p = strchr(dn, '?')) == NULL || *(p + 1) == '\0' || *(p + 1) == '?') { printfPQExpBuffer(errorMessage, libpq_gettext( - "bad LDAP URL \"%s\": must have exactly one attribute\n"), purl); + "bad LDAP URL \"%s\": must have exactly one attribute\n"), purl); free(url); return 3; } @@ -2447,7 +2465,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if ((p = strchr(attrs[0], '?')) == NULL || *(p + 1) == '\0' || *(p + 1) == '?') { printfPQExpBuffer(errorMessage, libpq_gettext( - "bad LDAP URL \"%s\": must have search scope (base/one/sub)\n"), purl); + "bad LDAP URL \"%s\": must have search scope (base/one/sub)\n"), purl); free(url); return 3; } @@ -2479,7 +2497,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (*portstr == '\0' || *endptr != '\0' || errno || lport < 0 || lport > 65535) { printfPQExpBuffer(errorMessage, libpq_gettext( - "bad LDAP URL \"%s\": invalid port number\n"), purl); + "bad LDAP URL \"%s\": invalid port number\n"), purl); free(url); return 3; } @@ -2490,7 +2508,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (strchr(attrs[0], ',') != NULL) { printfPQExpBuffer(errorMessage, libpq_gettext( - "bad LDAP URL \"%s\": must have exactly one attribute\n"), purl); + "bad LDAP URL \"%s\": must have exactly one attribute\n"), purl); free(url); return 3; } @@ -2505,7 +2523,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, else { printfPQExpBuffer(errorMessage, libpq_gettext( - "bad LDAP URL \"%s\": must have search scope (base/one/sub)\n"), purl); + "bad LDAP URL \"%s\": must have search scope (base/one/sub)\n"), purl); free(url); return 3; } @@ -2520,8 +2538,8 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, } /* - * Initialize connection to the server. We do an explicit bind because - * we want to return 2 if the bind fails. + * Initialize connection to the server. We do an explicit bind because we + * want to return 2 if the bind fails. */ if ((msgid = ldap_simple_bind(ld, NULL, NULL)) == -1) { @@ -2655,8 +2673,8 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, else if (ld_is_nl_cr(*p)) { printfPQExpBuffer(errorMessage, libpq_gettext( - "missing \"=\" after \"%s\" in connection info string\n"), - optname); + "missing \"=\" after \"%s\" in connection info string\n"), + optname); return 3; } else if (*p == '=') @@ -2673,8 +2691,8 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, else if (!ld_is_sp_tab(*p)) { printfPQExpBuffer(errorMessage, libpq_gettext( - "missing \"=\" after \"%s\" in connection info string\n"), - optname); + "missing \"=\" after \"%s\" in connection info string\n"), + optname); return 3; } break; @@ -2737,7 +2755,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, { printfPQExpBuffer(errorMessage, libpq_gettext("invalid connection option \"%s\"\n"), - optname); + optname); return 1; } optname = NULL; @@ -2749,7 +2767,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (state == 5 || state == 6) { printfPQExpBuffer(errorMessage, libpq_gettext( - "unterminated quoted string in connection info string\n")); + "unterminated quoted string in connection info string\n")); return 3; } @@ -2854,7 +2872,8 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage) #ifdef USE_LDAP if (strncmp(line, "ldap", 4) == 0) { - int rc = ldapServiceLookup(line, options, errorMessage); + int rc = ldapServiceLookup(line, options, errorMessage); + /* if rc = 2, go on reading for fallback */ switch (rc) { @@ -3376,10 +3395,10 @@ PQsetClientEncoding(PGconn *conn, const char *encoding) else { /* - * In protocol 2 we have to assume the setting will stick, and - * adjust our state immediately. In protocol 3 and up we can - * rely on the backend to report the parameter value, and we'll - * change state at that time. + * In protocol 2 we have to assume the setting will stick, and adjust + * our state immediately. In protocol 3 and up we can rely on the + * backend to report the parameter value, and we'll change state at + * that time. */ if (PG_PROTOCOL_MAJOR(conn->pversion) < 3) pqSaveParameterStatus(conn, "client_encoding", encoding); @@ -3547,14 +3566,14 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username) if (hostname == NULL) hostname = DefaultHost; else if (is_absolute_path(hostname)) + /* - * We should probably use canonicalize_path(), but then - * we have to bring path.c into libpq, and it doesn't - * seem worth it. + * We should probably use canonicalize_path(), but then we have to + * bring path.c into libpq, and it doesn't seem worth it. */ if (strcmp(hostname, DEFAULT_PGSOCKET_DIR) == 0) hostname = DefaultHost; - + if (port == NULL) port = DEF_PGPORT_STR; diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 71d9c02eb1e..5a7adb2ff8b 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.190 2006/08/18 19:52:39 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.191 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -45,7 +45,7 @@ char *const pgresStatus[] = { * values that result in backward-compatible behavior */ static int static_client_encoding = PG_SQL_ASCII; -static bool static_std_strings = false; +static bool static_std_strings = false; static bool PQsendQueryStart(PGconn *conn); @@ -61,8 +61,8 @@ static int PQsendQueryGuts(PGconn *conn, static void parseInput(PGconn *conn); static bool PQexecStart(PGconn *conn); static PGresult *PQexecFinish(PGconn *conn); -static int PQsendDescribe(PGconn *conn, char desc_type, - const char *desc_target); +static int PQsendDescribe(PGconn *conn, char desc_type, + const char *desc_target); /* ---------------- @@ -626,11 +626,11 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value) } /* - * Special hacks: remember client_encoding and standard_conforming_strings, - * and convert server version to a numeric form. We keep the first two of - * these in static variables as well, so that PQescapeString and - * PQescapeBytea can behave somewhat sanely (at least in single- - * connection-using programs). + * Special hacks: remember client_encoding and + * standard_conforming_strings, and convert server version to a numeric + * form. We keep the first two of these in static variables as well, so + * that PQescapeString and PQescapeBytea can behave somewhat sanely (at + * least in single- connection-using programs). */ if (strcmp(name, "client_encoding") == 0) { @@ -1483,7 +1483,7 @@ PQexecFinish(PGconn *conn) * If the query was not even sent, return NULL; conn->errorMessage is set to * a relevant message. * If the query was sent, a new PGresult is returned (which could indicate - * either success or failure). On success, the PGresult contains status + * either success or failure). On success, the PGresult contains status * PGRES_COMMAND_OK, and its parameter and column-heading fields describe * the statement's inputs and outputs respectively. * The user is responsible for freeing the PGresult via PQclear() @@ -1549,8 +1549,8 @@ PQsendDescribePortal(PGconn *conn, const char *portal) * Common code to send a Describe command * * Available options for desc_type are - * 'S' to describe a prepared statement; or - * 'P' to describe a portal. + * 'S' to describe a prepared statement; or + * 'P' to describe a portal. * Returns 1 on success and 0 on failure. */ static int @@ -1661,11 +1661,11 @@ PQputCopyData(PGconn *conn, const char *buffer, int nbytes) /* * Process any NOTICE or NOTIFY messages that might be pending in the - * input buffer. Since the server might generate many notices during - * the COPY, we want to clean those out reasonably promptly to prevent - * indefinite expansion of the input buffer. (Note: the actual read - * of input data into the input buffer happens down inside pqSendSome, - * but it's not authorized to get rid of the data again.) + * input buffer. Since the server might generate many notices during the + * COPY, we want to clean those out reasonably promptly to prevent + * indefinite expansion of the input buffer. (Note: the actual read of + * input data into the input buffer happens down inside pqSendSome, but + * it's not authorized to get rid of the data again.) */ parseInput(conn); @@ -2134,7 +2134,7 @@ check_param_number(const PGresult *res, int param_num) param_num, res->numParameters - 1); return FALSE; } - + return TRUE; } @@ -2377,7 +2377,8 @@ PQoidValue(const PGresult *res) char * PQcmdTuples(PGresult *res) { - char *p, *c; + char *p, + *c; if (!res) return ""; @@ -2389,7 +2390,7 @@ PQcmdTuples(PGresult *res) while (*p && *p != ' ') p++; if (*p == 0) - goto interpret_error; /* no space? */ + goto interpret_error; /* no space? */ p++; } else if (strncmp(res->cmdStatus, "DELETE ", 7) == 0 || @@ -2413,7 +2414,7 @@ PQcmdTuples(PGresult *res) goto interpret_error; return p; - + interpret_error: pqInternalNotice(&res->noticeHooks, "could not interpret result from server: %s", @@ -2462,7 +2463,7 @@ PQgetisnull(const PGresult *res, int tup_num, int field_num) } /* PQnparams: - * returns the number of input parameters of a prepared statement. + * returns the number of input parameters of a prepared statement. */ int PQnparams(const PGresult *res) @@ -2473,7 +2474,7 @@ PQnparams(const PGresult *res) } /* PQparamtype: - * returns type Oid of the specified statement parameter. + * returns type Oid of the specified statement parameter. */ Oid PQparamtype(const PGresult *res, int param_num) @@ -2612,9 +2613,9 @@ PQescapeStringInternal(PGconn *conn, while (remaining > 0 && *source != '\0') { - char c = *source; - int len; - int i; + char c = *source; + int len; + int i; /* Fast path for plain ASCII */ if (!IS_HIGHBIT_SET(c)) @@ -2643,9 +2644,9 @@ PQescapeStringInternal(PGconn *conn, /* * If we hit premature end of string (ie, incomplete multibyte - * character), try to pad out to the correct length with spaces. - * We may not be able to pad completely, but we will always be able - * to insert at least one pad space (since we'd not have quoted a + * character), try to pad out to the correct length with spaces. We + * may not be able to pad completely, but we will always be able to + * insert at least one pad space (since we'd not have quoted a * multibyte character). This should be enough to make a string that * the server will error out on. */ @@ -2655,7 +2656,7 @@ PQescapeStringInternal(PGconn *conn, *error = 1; if (conn) printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("incomplete multibyte character\n")); + libpq_gettext("incomplete multibyte character\n")); for (; i < len; i++) { if (((size_t) (target - to)) / 2 >= length) diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 998a5648992..10e8a91ed3e 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.59 2006/09/07 15:37:25 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.60 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -479,10 +479,10 @@ lo_import(PGconn *conn, const char *filename) if (tmp != nbytes) { /* - * If lo_write() failed, we are now in an aborted transaction - * so there's no need for lo_close(); furthermore, if we tried - * it we'd overwrite the useful error result with a useless one. - * So just nail the doors shut and get out of town. + * If lo_write() failed, we are now in an aborted transaction so + * there's no need for lo_close(); furthermore, if we tried it + * we'd overwrite the useful error result with a useless one. So + * just nail the doors shut and get out of town. */ (void) close(fd); return InvalidOid; @@ -492,7 +492,7 @@ lo_import(PGconn *conn, const char *filename) if (nbytes < 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not read from file \"%s\": %s\n"), + libpq_gettext("could not read from file \"%s\": %s\n"), filename, pqStrerror(errno, sebuf, sizeof(sebuf))); lobjOid = InvalidOid; } @@ -565,10 +565,10 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename) } /* - * If lo_read() failed, we are now in an aborted transaction - * so there's no need for lo_close(); furthermore, if we tried - * it we'd overwrite the useful error result with a useless one. - * So skip lo_close() if we got a failure result. + * If lo_read() failed, we are now in an aborted transaction so there's no + * need for lo_close(); furthermore, if we tried it we'd overwrite the + * useful error result with a useless one. So skip lo_close() if we got a + * failure result. */ if (nbytes < 0 || lo_close(conn, lobj) != 0) diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 2c76dfdde36..635c3f0674d 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -23,7 +23,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.129 2006/07/14 05:28:29 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.130 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ static int pqPutMsgBytes(const void *buf, size_t len, PGconn *conn); static int pqSendSome(PGconn *conn, int len); -static int pqSocketCheck(PGconn *conn, int forRead, int forWrite, +static int pqSocketCheck(PGconn *conn, int forRead, int forWrite, time_t end_time); static int pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time); diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index 0ecbcf4ad03..9ae7a1fa076 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -10,7 +10,7 @@ * didn't really belong there. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.72 2006/07/14 16:59:19 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.73 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -276,7 +276,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) { if (po->caption) fprintf(fout, - "<table %s><caption align=\"top\">%s</caption>\n", + "<table %s><caption align=\"top\">%s</caption>\n", po->tableOpt ? po->tableOpt : "", po->caption); else diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index 1feae23a437..8f75577c859 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.28 2006/10/01 22:25:48 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.29 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ static int getNotify(PGconn *conn); static int getCopyStart(PGconn *conn, ExecStatusType copytype); static int getReadyForQuery(PGconn *conn); static void reportErrorPosition(PQExpBuffer msg, const char *query, - int loc, int encoding); + int loc, int encoding); static int build_startup_packet(const PGconn *conn, char *packet, const PQEnvironmentOption *options); @@ -270,9 +270,10 @@ pqParseInput3(PGconn *conn) /* First 'T' in a query sequence */ if (getRowDescriptions(conn)) return; + /* - * If we're doing a Describe, we're ready to pass - * the result back to the client. + * If we're doing a Describe, we're ready to pass the + * result back to the client. */ if (conn->queryclass == PGQUERY_DESCRIBE) conn->asyncStatus = PGASYNC_READY; @@ -301,9 +302,10 @@ pqParseInput3(PGconn *conn) if (conn->result == NULL) conn->result = PQmakeEmptyPGresult(conn, PGRES_COMMAND_OK); + /* - * If we're doing a Describe, we're ready to pass - * the result back to the client. + * If we're doing a Describe, we're ready to pass the + * result back to the client. */ if (conn->queryclass == PGQUERY_DESCRIBE) conn->asyncStatus = PGASYNC_READY; @@ -443,9 +445,9 @@ getRowDescriptions(PGconn *conn) int i; /* - * When doing Describe for a prepared statement, there'll already be - * a PGresult created by getParamDescriptions, and we should fill - * data into that. Otherwise, create a new, empty PGresult. + * When doing Describe for a prepared statement, there'll already be a + * PGresult created by getParamDescriptions, and we should fill data into + * that. Otherwise, create a new, empty PGresult. */ if (conn->queryclass == PGQUERY_DESCRIBE) { @@ -527,14 +529,15 @@ getRowDescriptions(PGconn *conn) return 0; failure: + /* * Discard incomplete result, unless it's from getParamDescriptions. * * Note that if we hit a bufferload boundary while handling the * describe-statement case, we'll forget any PGresult space we just - * allocated, and then reallocate it on next try. This will bloat - * the PGresult a little bit but the space will be freed at PQclear, - * so it doesn't seem worth trying to be smarter. + * allocated, and then reallocate it on next try. This will bloat the + * PGresult a little bit but the space will be freed at PQclear, so it + * doesn't seem worth trying to be smarter. */ if (result != conn->result) PQclear(result); @@ -553,10 +556,10 @@ failure: static int getParamDescriptions(PGconn *conn) { - PGresult *result; - int nparams; - int i; - + PGresult *result; + int nparams; + int i; + result = PQmakeEmptyPGresult(conn, PGRES_COMMAND_OK); if (!result) goto failure; @@ -580,8 +583,8 @@ getParamDescriptions(PGconn *conn) /* get parameter info */ for (i = 0; i < nparams; i++) { - int typid; - + int typid; + if (pqGetInt(&typid, 4, conn)) goto failure; result->paramDescs[i].typid = typid; @@ -910,7 +913,7 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) /* * Each character might occupy multiple physical bytes in the string, and * in some Far Eastern character sets it might take more than one screen - * column as well. We compute the starting byte offset and starting + * column as well. We compute the starting byte offset and starting * screen column of each logical character, and store these in qidx[] and * scridx[] respectively. */ @@ -936,13 +939,13 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) mb_encoding = (pg_encoding_max_length(encoding) != 1); /* - * Within the scanning loop, cno is the current character's logical number, - * qoffset is its offset in wquery, and scroffset is its starting logical - * screen column (all indexed from 0). "loc" is the logical character - * number of the error location. We scan to determine loc_line (the - * 1-based line number containing loc) and ibeg/iend (first character - * number and last+1 character number of the line containing loc). - * Note that qidx[] and scridx[] are filled only as far as iend. + * Within the scanning loop, cno is the current character's logical + * number, qoffset is its offset in wquery, and scroffset is its starting + * logical screen column (all indexed from 0). "loc" is the logical + * character number of the error location. We scan to determine loc_line + * (the 1-based line number containing loc) and ibeg/iend (first character + * number and last+1 character number of the line containing loc). Note + * that qidx[] and scridx[] are filled only as far as iend. */ qoffset = 0; scroffset = 0; @@ -952,7 +955,7 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) for (cno = 0; wquery[qoffset] != '\0'; cno++) { - char ch = wquery[qoffset]; + char ch = wquery[qoffset]; qidx[cno] = qoffset; scridx[cno] = scroffset; @@ -966,8 +969,8 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) wquery[qoffset] = ' '; /* - * If end-of-line, count lines and mark positions. Each \r or \n counts - * as a line except when \r \n appear together. + * If end-of-line, count lines and mark positions. Each \r or \n + * counts as a line except when \r \n appear together. */ else if (ch == '\r' || ch == '\n') { @@ -992,7 +995,7 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) /* Advance */ if (mb_encoding) { - int w; + int w; w = pg_encoding_dsplen(encoding, &wquery[qoffset]); /* treat any non-tab control chars as width 1 */ @@ -1069,7 +1072,7 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) scroffset = 0; for (; i < msg->len; i += pg_encoding_mblen(encoding, &msg->data[i])) { - int w = pg_encoding_dsplen(encoding, &msg->data[i]); + int w = pg_encoding_dsplen(encoding, &msg->data[i]); if (w <= 0) w = 1; diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index d886179f6d2..859df9acf87 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.87 2006/09/27 15:41:24 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.88 2006/10/04 00:30:13 momjian Exp $ * * NOTES * [ Most of these notes are wrong/obsolete, but perhaps not all ] @@ -782,7 +782,7 @@ initialize_SSL(PGconn *conn) if (stat(fnbuf, &buf) == 0) { X509_STORE *cvstore; - + if (!SSL_CTX_load_verify_locations(SSL_context, fnbuf, NULL)) { char *err = SSLerrmessage(); @@ -800,13 +800,13 @@ initialize_SSL(PGconn *conn) if (X509_STORE_load_locations(cvstore, ROOT_CRL_FILE, NULL) != 0) /* OpenSSL 0.96 does not support X509_V_FLAG_CRL_CHECK */ #ifdef X509_V_FLAG_CRL_CHECK - X509_STORE_set_flags(cvstore, - X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL); + X509_STORE_set_flags(cvstore, + X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); /* if not found, silently ignore; we do not require CRL */ #else { char *err = SSLerrmessage(); - + printfPQExpBuffer(&conn->errorMessage, libpq_gettext("Installed SSL library does not support CRL certificates, file \"%s\"\n"), fnbuf); @@ -815,7 +815,7 @@ initialize_SSL(PGconn *conn) } #endif } - + SSL_CTX_set_verify(SSL_context, SSL_VERIFY_PEER, verify_cb); } } diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 135791a4f1e..daa29cc3b12 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.133 2006/09/07 15:37:25 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.134 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -410,8 +410,8 @@ extern int PQnparams(const PGresult *res); extern Oid PQparamtype(const PGresult *res, int param_num); /* Describe prepared statements and portals */ -extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); -extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); +extern PGresult *PQdescribePrepared(PGconn *conn, const char *stmt); +extern PGresult *PQdescribePortal(PGconn *conn, const char *portal); extern int PQsendDescribePrepared(PGconn *conn, const char *stmt); extern int PQsendDescribePortal(PGconn *conn, const char *portal); @@ -437,13 +437,14 @@ extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status); /* Quoting strings before inclusion in queries. */ extern size_t PQescapeStringConn(PGconn *conn, - char *to, const char *from, size_t length, - int *error); + char *to, const char *from, size_t length, + int *error); extern unsigned char *PQescapeByteaConn(PGconn *conn, const unsigned char *from, size_t from_length, size_t *to_length); extern unsigned char *PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen); + /* These forms are deprecated! */ extern size_t PQescapeString(char *to, const char *from, size_t length); extern unsigned char *PQescapeBytea(const unsigned char *from, size_t from_length, diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index e3532fbf6f1..e69200f5af9 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.115 2006/08/18 19:52:39 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.116 2006/10/04 00:30:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -285,7 +285,7 @@ struct pg_conn /* Status indicators */ ConnStatusType status; PGAsyncStatusType asyncStatus; - PGTransactionStatusType xactStatus; /* never changes to ACTIVE */ + PGTransactionStatusType xactStatus; /* never changes to ACTIVE */ PGQueryClass queryclass; char *last_query; /* last SQL command, or NULL if unknown */ bool options_valid; /* true if OK to attempt connection */ diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index 2867aba2d55..a4ec2ebb70c 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -29,7 +29,7 @@ #include "win32.h" -/* Declared here to avoid pulling in all includes, which causes name collissions */ +/* Declared here to avoid pulling in all includes, which causes name collissions */ #ifdef ENABLE_NLS extern char * libpq_gettext(const char *msgid) |