diff options
Diffstat (limited to 'src/interfaces/libpq')
-rw-r--r-- | src/interfaces/libpq/fe-auth.c | 8 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 59 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-exec.c | 30 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-lobj.c | 2 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-protocol2.c | 12 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-protocol3.c | 26 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 31 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 3 | ||||
-rw-r--r-- | src/interfaces/libpq/pqexpbuffer.c | 10 | ||||
-rw-r--r-- | src/interfaces/libpq/pqexpbuffer.h | 8 | ||||
-rw-r--r-- | src/interfaces/libpq/test/uri-regress.c | 2 |
13 files changed, 101 insertions, 98 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 5ddd17d5df7..f5ec2e01780 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -742,9 +742,9 @@ pg_fe_getauthname(void) pglock_thread(); /* - * We document PQconndefaults() to return NULL for a memory allocation - * failure. We don't have an API to return a user name lookup failure, - * so we just assume it always succeeds. + * We document PQconndefaults() to return NULL for a memory allocation + * failure. We don't have an API to return a user name lookup failure, so + * we just assume it always succeeds. */ #ifdef WIN32 if (GetUserName(username, &namesize)) @@ -767,7 +767,7 @@ pg_fe_getauthname(void) * * 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 0791774af78..540426cbe96 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -134,7 +134,7 @@ static int ldapServiceLookup(const char *purl, PQconninfoOption *options, * * PQconninfoOptions[] is a constant static array that we use to initialize * a dynamically allocated working copy. All the "val" fields in - * PQconninfoOptions[] *must* be NULL. In a working copy, non-null "val" + * PQconninfoOptions[] *must* be NULL. In a working copy, non-null "val" * fields point to malloc'd strings that should be freed when the working * array is freed (see PQconninfoFree). * @@ -389,7 +389,7 @@ pgthreadlock_t pg_g_threadlock = default_threadlock; * pqDropConnection * * Close any physical connection to the server, and reset associated - * state inside the connection object. We don't release state that + * state inside the connection object. We don't release state that * would be needed to reconnect, though. */ void @@ -544,7 +544,7 @@ PQping(const char *conninfo) * See comment for PQconnectdbParams for the definition of the string format. * * Returns a PGconn*. If NULL is returned, a malloc error has occurred, and - * you should not attempt to proceed with this connection. If the status + * you should not attempt to proceed with this connection. If the status * field of the connection returned is CONNECTION_BAD, an error has * occurred. In this case you should call PQfinish on the result, (perhaps * inspecting the error message first). Other fields of the structure may not @@ -619,7 +619,7 @@ PQconnectStartParams(const char *const * keywords, * See comment for PQconnectdb for the definition of the string format. * * Returns a PGconn*. If NULL is returned, a malloc error has occurred, and - * you should not attempt to proceed with this connection. If the status + * you should not attempt to proceed with this connection. If the status * field of the connection returned is CONNECTION_BAD, an error has * occurred. In this case you should call PQfinish on the result, (perhaps * inspecting the error message first). Other fields of the structure may not @@ -856,7 +856,7 @@ connectOptions2(PGconn *conn) * and their current default values. * * NOTE: as of PostgreSQL 7.0, the returned array is dynamically allocated - * and should be freed when no longer needed via PQconninfoFree(). (In prior + * and should be freed when no longer needed via PQconninfoFree(). (In prior * versions, the returned array was static, but that's not thread-safe.) * Pre-7.0 applications that use this function will see a small memory leak * until they are updated to call PQconninfoFree. @@ -1480,7 +1480,7 @@ connectDBComplete(PGconn *conn) for (;;) { /* - * Wait, if necessary. Note that the initial state (just after + * Wait, if necessary. Note that the initial state (just after * PQconnectStart) is to wait for the socket to select for writing. */ switch (flag) @@ -1542,7 +1542,7 @@ connectDBComplete(PGconn *conn) * will not block. * o If you do not supply an IP address for the remote host (i.e. you * supply a host name instead) then PQconnectStart will block on - * gethostbyname. You will be fine if using Unix sockets (i.e. by + * gethostbyname. You will be fine if using Unix sockets (i.e. by * supplying neither a host name nor a host address). * o If your backend wants to use Kerberos authentication then you must * supply both a host name and a host address, otherwise this function @@ -1606,7 +1606,7 @@ PQconnectPoll(PGconn *conn) libpq_gettext( "invalid connection state, " "probably indicative of memory corruption\n" - )); + )); goto error_return; } @@ -1809,7 +1809,7 @@ keep_going: /* We will come back to here until there is /* * This connection failed --- set up error report, then * close socket (do it this way in case close() affects - * the value of errno...). We will ignore the connect() + * the value of errno...). We will ignore the connect() * failure and keep going if there are more addresses. */ connectFailureMessage(conn, SOCK_ERRNO); @@ -2097,7 +2097,7 @@ keep_going: /* We will come back to here until there is { /* * Server failure of some sort, such as failure to - * fork a backend process. We need to process and + * fork a backend process. We need to process and * report the error message, which might be formatted * according to either protocol 2 or protocol 3. * Rather than duplicate the code for that, we flip @@ -2478,7 +2478,7 @@ keep_going: /* We will come back to here until there is /* * If we tried to send application_name, check to see * if the error is about that --- pre-9.0 servers will - * reject it at this stage of the process. If so, + * reject it at this stage of the process. If so, * close the connection and retry without sending * application_name. We could possibly get a false * SQLSTATE match here and retry uselessly, but there @@ -2624,9 +2624,9 @@ internal_ping(PGconn *conn) /* * If we failed to get any ERROR response from the postmaster, report - * PQPING_NO_RESPONSE. This result could be somewhat misleading for a + * PQPING_NO_RESPONSE. This result could be somewhat misleading for a * pre-7.4 server, since it won't send back a SQLSTATE, but those are long - * out of support. Another corner case where the server could return a + * out of support. Another corner case where the server could return a * failure without a SQLSTATE is fork failure, but NO_RESPONSE isn't * totally unreasonable for that anyway. We expect that every other * failure case in a modern server will produce a report with a SQLSTATE. @@ -2666,6 +2666,7 @@ makeEmptyPGconn(void) PGconn *conn; #ifdef WIN32 + /* * Make sure socket support is up and running. */ @@ -2853,7 +2854,7 @@ freePGconn(PGconn *conn) * - properly close a connection to the backend * * This should reset or release all transient state, but NOT the connection - * parameters. On exit, the PGconn should be in condition to start a fresh + * parameters. On exit, the PGconn should be in condition to start a fresh * connection with the same parameters (see PQreset()). */ static void @@ -2982,7 +2983,7 @@ PQreset(PGconn *conn) if (connectDBStart(conn) && connectDBComplete(conn)) { /* - * Notify event procs of successful reset. We treat an event proc + * Notify event procs of successful reset. We treat an event proc * failure as disabling the connection ... good idea? */ int i; @@ -3042,7 +3043,7 @@ PQresetPoll(PGconn *conn) if (status == PGRES_POLLING_OK) { /* - * Notify event procs of successful reset. We treat an event proc + * Notify event procs of successful reset. We treat an event proc * failure as disabling the connection ... good idea? */ int i; @@ -3231,7 +3232,7 @@ cancel_errReturn: * Returns TRUE if able to send the cancel request, FALSE if not. * * On failure, an error message is stored in *errbuf, which must be of size - * errbufsize (recommended size is 256 bytes). *errbuf is not changed on + * errbufsize (recommended size is 256 bytes). *errbuf is not changed on * success return. */ int @@ -3516,12 +3517,12 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, * * LDAP does not require that an anonymous bind is performed explicitly, * but we want to distinguish between the case where LDAP bind does not - * succeed within PGLDAP_TIMEOUT seconds (return 2 to continue parsing - * the service control file) and the case where querying the LDAP server - * fails (return 1 to end parsing). + * succeed within PGLDAP_TIMEOUT seconds (return 2 to continue parsing the + * service control file) and the case where querying the LDAP server fails + * (return 1 to end parsing). * - * Unfortunately there is no way of setting a timeout that works for - * both Windows and OpenLDAP. + * Unfortunately there is no way of setting a timeout that works for both + * Windows and OpenLDAP. */ #ifdef WIN32 /* the nonstandard ldap_connect function performs an anonymous bind */ @@ -3532,7 +3533,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, ldap_unbind(ld); return 2; } -#else /* !WIN32 */ +#else /* !WIN32 */ /* in OpenLDAP, use the LDAP_OPT_NETWORK_TIMEOUT option */ if (ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &time) != LDAP_SUCCESS) { @@ -3572,7 +3573,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, ldap_unbind(ld); return 3; } -#endif /* WIN32 */ +#endif /* WIN32 */ /* search */ res = NULL; @@ -3788,7 +3789,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, return 0; } -#endif /* USE_LDAP */ +#endif /* USE_LDAP */ #define MAXBUFSIZE 256 @@ -4008,7 +4009,7 @@ parseServiceFile(const char *serviceFile, * PQconninfoParse * * Parse a string like PQconnectdb() would do and return the - * resulting connection options array. NULL is returned on failure. + * resulting connection options array. NULL is returned on failure. * The result contains only options specified directly in the string, * not any possible default values. * @@ -4461,8 +4462,8 @@ conninfo_add_defaults(PQconninfoOption *options, PQExpBuffer errorMessage) /* * If there's a service spec, use it to obtain any not-explicitly-given - * parameters. Ignore error if no error message buffer is passed - * because there is no way to pass back the failure message. + * parameters. Ignore error if no error message buffer is passed because + * there is no way to pass back the failure message. */ if (parseServiceInfo(options, errorMessage) != 0 && errorMessage) return false; @@ -4792,7 +4793,7 @@ cleanup: * Connection URI parameters parser routine * * If successful, returns true while connOptions is filled with parsed - * parameters. Otherwise, returns false and fills errorMessage appropriately. + * parameters. Otherwise, returns false and fills errorMessage appropriately. * * Destructively modifies 'params' buffer. */ diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 50e4035781a..4075e518410 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -94,7 +94,7 @@ static int check_field_number(const PGresult *res, int field_num); * doesn't tell us up front how many tuples will be returned.) * All other subsidiary storage for a PGresult is kept in PGresult_data blocks * of size PGRESULT_DATA_BLOCKSIZE. The overhead at the start of each block - * is just a link to the next one, if any. Free-space management info is + * is just a link to the next one, if any. Free-space management info is * kept in the owning PGresult. * A query returning a small amount of data will thus require three malloc * calls: one for the PGresult, one for the tuples pointer array, and one @@ -113,7 +113,7 @@ static int check_field_number(const PGresult *res, int field_num); * blocks, instead of being crammed into a regular allocation block. * Requirements for correct function are: * PGRESULT_ALIGN_BOUNDARY must be a multiple of the alignment requirements - * of all machine data types. (Currently this is set from configure + * of all machine data types. (Currently this is set from configure * tests, so it should be OK automatically.) * PGRESULT_SEP_ALLOC_THRESHOLD + PGRESULT_BLOCK_OVERHEAD <= * PGRESULT_DATA_BLOCKSIZE @@ -268,10 +268,10 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs) * Returns a deep copy of the provided 'src' PGresult, which cannot be NULL. * The 'flags' argument controls which portions of the result will or will * NOT be copied. The created result is always put into the - * PGRES_TUPLES_OK status. The source result error message is not copied, + * PGRES_TUPLES_OK status. The source result error message is not copied, * although cmdStatus is. * - * To set custom attributes, use PQsetResultAttrs. That function requires + * To set custom attributes, use PQsetResultAttrs. That function requires * that there are no attrs contained in the result, so to use that * function you cannot use the PG_COPYRES_ATTRS or PG_COPYRES_TUPLES * options with this function. @@ -299,7 +299,7 @@ PQcopyResult(const PGresult *src, int flags) if (!dest) return NULL; - /* Always copy these over. Is cmdStatus really useful here? */ + /* Always copy these over. Is cmdStatus really useful here? */ dest->client_encoding = src->client_encoding; strcpy(dest->cmdStatus, src->cmdStatus); @@ -757,7 +757,7 @@ pqPrepareAsyncResult(PGconn *conn) PGresult *res; /* - * conn->result is the PGresult to return. If it is NULL (which probably + * conn->result is the PGresult to return. If it is NULL (which probably * shouldn't happen) we assume there is an appropriate error message in * conn->errorMessage. */ @@ -778,7 +778,7 @@ pqPrepareAsyncResult(PGconn *conn) /* * Replace conn->result with next_result, if any. In the normal case * there isn't a next result and we're just dropping ownership of the - * current result. In single-row mode this restores the situation to what + * current result. In single-row mode this restores the situation to what * it was before we created the current single-row result. */ conn->result = conn->next_result; @@ -1569,7 +1569,7 @@ pqHandleSendFailure(PGconn *conn) /* loop until no more data readable */ ; /* - * Parse any available input messages. Since we are in PGASYNC_IDLE + * Parse any available input messages. Since we are in PGASYNC_IDLE * state, only NOTICE and NOTIFY messages will be eaten. */ parseInput(conn); @@ -1789,7 +1789,7 @@ getCopyResult(PGconn *conn, ExecStatusType copytype) * If the server connection has been lost, don't pretend everything is * hunky-dory; instead return a PGRES_FATAL_ERROR result, and reset the * asyncStatus to idle (corresponding to what we'd do if we'd detected I/O - * error in the earlier steps in PQgetResult). The text returned in the + * error in the earlier steps in PQgetResult). The text returned in the * result is whatever is in conn->errorMessage; we hope that was filled * with something relevant when the lost connection was detected. */ @@ -2031,7 +2031,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() @@ -2374,7 +2374,7 @@ PQgetCopyData(PGconn *conn, char **buffer, int async) * PQgetline - gets a newline-terminated string from the backend. * * Chiefly here so that applications can use "COPY <rel> to stdout" - * and read the output string. Returns a null-terminated string in s. + * and read the output string. Returns a null-terminated string in s. * * XXX this routine is now deprecated, because it can't handle binary data. * If called during a COPY BINARY we return EOF. @@ -2488,7 +2488,7 @@ PQputnbytes(PGconn *conn, const char *buffer, int nbytes) * the application must call this routine to finish the command protocol. * * When using protocol 3.0 this is deprecated; it's cleaner to use PQgetResult - * to get the transfer status. Note however that when using 2.0 protocol, + * to get the transfer status. Note however that when using 2.0 protocol, * recovering from a copy failure often requires a PQreset. PQendcopy will * take care of that, PQgetResult won't. * @@ -2716,7 +2716,7 @@ PQfname(const PGresult *res, int field_num) * downcasing in the frontend might follow different locale rules than * downcasing in the backend... * - * Returns -1 if no match. In the present backend it is also possible + * Returns -1 if no match. In the present backend it is also possible * to have multiple matches, in which case the first one is found. */ int @@ -3149,7 +3149,7 @@ PQfreemem(void *ptr) * * This function is here only for binary backward compatibility. * New code should use PQfreemem(). A macro will automatically map - * calls to PQfreemem. It should be removed in the future. bjm 2003-03-24 + * calls to PQfreemem. It should be removed in the future. bjm 2003-03-24 */ #undef PQfreeNotify @@ -3344,7 +3344,7 @@ PQescapeInternal(PGconn *conn, const char *str, size_t len, bool as_ident) /* * If we are escaping a literal that contains backslashes, we use the * escape string syntax so that the result is correct under either value - * of standard_conforming_strings. We also emit a leading space in this + * of standard_conforming_strings. We also emit a leading space in this * case, to guard against the possibility that the result might be * interpolated immediately following an identifier. */ diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 8d29282fc6d..18de2914d34 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -899,7 +899,7 @@ lo_initialize(PGconn *conn) MemSet((char *) lobjfuncs, 0, sizeof(PGlobjfuncs)); /* - * Execute the query to get all the functions at once. In 7.3 and later + * Execute the query to get all the functions at once. In 7.3 and later * we need to be schema-safe. lo_create only exists in 8.1 and up. * lo_truncate only exists in 8.3 and up. */ diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index cc487b22eec..a28a09790b6 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -681,13 +681,13 @@ retry3: /* * Hack to deal with the fact that some kernels will only give us back * 1 packet per recv() call, even if we asked for more and there is - * more available. If it looks like we are reading a long message, + * more available. If it looks like we are reading a long message, * loop back to recv() again immediately, until we run out of data or * buffer space. Without this, the block-and-restart behavior of * libpq's higher levels leads to O(N^2) performance on long messages. * * Since we left-justified the data above, conn->inEnd gives the - * amount of data already read in the current message. We consider + * amount of data already read in the current message. We consider * the message "long" once we have acquired 32k ... */ if (conn->inEnd > 32768 && diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c index 10510b5bf5a..59e4a4973f2 100644 --- a/src/interfaces/libpq/fe-protocol2.c +++ b/src/interfaces/libpq/fe-protocol2.c @@ -231,7 +231,7 @@ pqSetenvPoll(PGconn *conn) case SETENV_STATE_QUERY1_SEND: { /* - * Issue query to get information we need. Here we must + * Issue query to get information we need. Here we must * use begin/commit in case autocommit is off by default * in a 7.3 server. * @@ -725,7 +725,7 @@ getRowDescriptions(PGconn *conn) advance_and_error: /* - * Discard the failed message. Unfortunately we don't know for sure where + * Discard the failed message. Unfortunately we don't know for sure where * the end is, so just throw away everything in the input buffer. This is * not very desirable but it's the best we can do in protocol v2. */ @@ -898,7 +898,7 @@ getAnotherTuple(PGconn *conn, bool binary) advance_and_error: /* - * Discard the failed message. Unfortunately we don't know for sure where + * Discard the failed message. Unfortunately we don't know for sure where * the end is, so just throw away everything in the input buffer. This is * not very desirable but it's the best we can do in protocol v2. */ @@ -954,7 +954,7 @@ pqGetErrorNotice2(PGconn *conn, bool isError) /* * Since the message might be pretty long, we create a temporary - * PQExpBuffer rather than using conn->workBuffer. workBuffer is intended + * PQExpBuffer rather than using conn->workBuffer. workBuffer is intended * for stuff that is expected to be short. */ initPQExpBuffer(&workBuf); @@ -1048,10 +1048,10 @@ failure: /* * checkXactStatus - attempt to track transaction-block status of server * - * This is called each time we receive a command-complete message. By + * This is called each time we receive a command-complete message. By * watching for messages from BEGIN/COMMIT/ROLLBACK commands, we can do * a passable job of tracking the server's xact status. BUT: this does - * not work at all on 7.3 servers with AUTOCOMMIT OFF. (Man, was that + * not work at all on 7.3 servers with AUTOCOMMIT OFF. (Man, was that * feature ever a mistake.) Caveat user. * * The tags known here are all those used as far back as 7.0; is it worth diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index d895589148c..c514ca5841c 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -166,7 +166,7 @@ pqParseInput3(PGconn *conn) * ERROR messages are displayed using the notice processor; * ParameterStatus is handled normally; anything else is just * dropped on the floor after displaying a suitable warning - * notice. (An ERROR is very possibly the backend telling us why + * notice. (An ERROR is very possibly the backend telling us why * it is about to close the connection, so we don't want to just * discard it...) */ @@ -364,7 +364,7 @@ pqParseInput3(PGconn *conn) case 'd': /* Copy Data */ /* - * If we see Copy Data, just silently drop it. This would + * If we see Copy Data, just silently drop it. This would * only occur if application exits COPY OUT mode too * early. */ @@ -373,7 +373,7 @@ pqParseInput3(PGconn *conn) case 'c': /* Copy Done */ /* - * If we see Copy Done, just silently drop it. This is + * If we see Copy Done, just silently drop it. This is * the normal case during PQendcopy. We will keep * swallowing data, expecting to see command-complete for * the COPY command. @@ -603,7 +603,7 @@ advance_and_error: pqSaveErrorResult(conn); /* - * Return zero to allow input parsing to continue. Subsequent "D" + * Return zero to allow input parsing to continue. Subsequent "D" * messages will be ignored until we get to end of data, since an error * result is already set up. */ @@ -785,7 +785,7 @@ set_error_result: pqSaveErrorResult(conn); /* - * Return zero to allow input parsing to continue. Subsequent "D" + * Return zero to allow input parsing to continue. Subsequent "D" * messages will be ignored until we get to end of data, since an error * result is already set up. */ @@ -812,14 +812,14 @@ pqGetErrorNotice3(PGconn *conn, bool isError) /* * Since the fields might be pretty long, we create a temporary - * PQExpBuffer rather than using conn->workBuffer. workBuffer is intended - * for stuff that is expected to be short. We shouldn't use + * PQExpBuffer rather than using conn->workBuffer. workBuffer is intended + * for stuff that is expected to be short. We shouldn't use * conn->errorMessage either, since this might be only a notice. */ initPQExpBuffer(&workBuf); /* - * Make a PGresult to hold the accumulated fields. We temporarily lie + * Make a PGresult to hold the accumulated fields. We temporarily lie * about the result status, so that PQmakeEmptyPGresult doesn't uselessly * copy conn->errorMessage. */ @@ -1031,7 +1031,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. */ @@ -1059,8 +1059,8 @@ reportErrorPosition(PQExpBuffer msg, const char *query, int loc, int encoding) /* * 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 + * 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. @@ -1511,7 +1511,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async) for (;;) { /* - * Collect the next input message. To make life simpler for async + * Collect the next input message. To make life simpler for async * callers, we keep returning 0 until the next message is fully * available, even if it is not Copy Data. */ @@ -1718,7 +1718,7 @@ pqEndcopy3(PGconn *conn) /* * Non blocking connections may have to abort at this point. If everyone * played the game there should be no problem, but in error scenarios the - * expected messages may not have arrived yet. (We are assuming that the + * expected messages may not have arrived yet. (We are assuming that the * backend's packetizing will ensure that CommandComplete arrives along * with the CopyDone; are there corner cases where that doesn't happen?) */ diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index d8ac40c7840..9ba35674d38 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -257,7 +257,7 @@ pqsecure_open_client(PGconn *conn) if (conn->ssl == NULL) { #ifdef ENABLE_THREAD_SAFETY - int rc; + int rc; #endif /* We cannot use MSG_NOSIGNAL to block SIGPIPE when using SSL */ @@ -267,7 +267,7 @@ pqsecure_open_client(PGconn *conn) if ((rc = pthread_mutex_lock(&ssl_config_mutex))) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not acquire mutex: %s\n"), strerror(rc)); + libpq_gettext("could not acquire mutex: %s\n"), strerror(rc)); return PGRES_POLLING_FAILED; } #endif @@ -292,6 +292,7 @@ pqsecure_open_client(PGconn *conn) #ifdef ENABLE_THREAD_SAFETY pthread_mutex_unlock(&ssl_config_mutex); #endif + /* * Load client certificate, private key, and trusted CA certs. */ @@ -1049,7 +1050,7 @@ destroy_ssl_system(void) * Initialize (potentially) per-connection SSL data, namely the * client certificate, private key, and trusted CA certs. * - * conn->ssl must already be created. It receives the connection's client + * conn->ssl must already be created. It receives the connection's client * certificate and private key. Note however that certificates also get * loaded into the SSL_context object, and are therefore accessible to all * connections in this process. This should be OK as long as there aren't @@ -1129,12 +1130,12 @@ initialize_SSL(PGconn *conn) * SSL_context struct. */ #ifdef ENABLE_THREAD_SAFETY - int rc; + int rc; if ((rc = pthread_mutex_lock(&ssl_config_mutex))) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not acquire mutex: %s\n"), strerror(rc)); + libpq_gettext("could not acquire mutex: %s\n"), strerror(rc)); return -1; } #endif @@ -1349,12 +1350,12 @@ initialize_SSL(PGconn *conn) X509_STORE *cvstore; #ifdef ENABLE_THREAD_SAFETY - int rc; + int rc; if ((rc = pthread_mutex_lock(&ssl_config_mutex))) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not acquire mutex: %s\n"), strerror(rc)); + libpq_gettext("could not acquire mutex: %s\n"), strerror(rc)); return -1; } #endif @@ -1414,7 +1415,7 @@ initialize_SSL(PGconn *conn) { /* * stat() failed; assume root file doesn't exist. If sslmode is - * verify-ca or verify-full, this is an error. Otherwise, continue + * verify-ca or verify-full, this is an error. Otherwise, continue * without performing any server cert verification. */ if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ @@ -1547,7 +1548,7 @@ open_client_SSL(PGconn *conn) static void close_SSL(PGconn *conn) { - bool destroy_needed = false; + bool destroy_needed = false; if (conn->ssl) { @@ -1586,9 +1587,9 @@ close_SSL(PGconn *conn) /* * This will remove our SSL locking hooks, if this is the last SSL - * connection, which means we must wait to call it until after all - * SSL calls have been made, otherwise we can end up with a race - * condition and possible deadlocks. + * connection, which means we must wait to call it until after all SSL + * calls have been made, otherwise we can end up with a race condition and + * possible deadlocks. * * See comments above destroy_ssl_system(). */ @@ -1663,7 +1664,7 @@ PQgetssl(PGconn *conn) #if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32) /* - * Block SIGPIPE for this thread. This prevents send()/write() from exiting + * Block SIGPIPE for this thread. This prevents send()/write() from exiting * the application. */ int @@ -1702,7 +1703,7 @@ pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending) * Discard any pending SIGPIPE and reset the signal mask. * * Note: we are effectively assuming here that the C library doesn't queue - * up multiple SIGPIPE events. If it did, then we'd accidentally leave + * up multiple SIGPIPE events. If it did, then we'd accidentally leave * ours in the queue when an event was already pending and we got another. * As long as it doesn't queue multiple events, we're OK because the caller * can't tell the difference. @@ -1713,7 +1714,7 @@ pq_block_sigpipe(sigset_t *osigset, bool *sigpipe_pending) * gotten one, pass got_epipe = TRUE. * * We do not want this to change errno, since if it did that could lose - * the error code from a preceding send(). We essentially assume that if + * the error code from a preceding send(). We essentially assume that if * we were able to do pq_block_sigpipe(), this can't fail. */ void diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 856bdff006f..80591728a0f 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -55,9 +55,9 @@ typedef enum * be used for user feedback or similar purposes. */ CONNECTION_STARTED, /* Waiting for connection to be made. */ - CONNECTION_MADE, /* Connection OK; waiting to send. */ + CONNECTION_MADE, /* Connection OK; waiting to send. */ CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the - * postmaster. */ + * postmaster. */ CONNECTION_AUTH_OK, /* Received authentication; waiting for * backend startup. */ CONNECTION_SETENV, /* Negotiating environment. */ diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 0725c17023d..4aeb4fad987 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -365,7 +365,8 @@ struct pg_conn /* Connection data */ /* See PQconnectPoll() for how we use 'int' and not 'pgsocket'. */ - pgsocket sock; /* FD for socket, PGINVALID_SOCKET if unconnected */ + pgsocket sock; /* FD for socket, PGINVALID_SOCKET if + * unconnected */ SockAddr laddr; /* Local address */ SockAddr raddr; /* Remote address */ ProtocolVersion pversion; /* FE/BE protocol version in use */ diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c index 54e62d3f11b..5c7fd42dc77 100644 --- a/src/interfaces/libpq/pqexpbuffer.c +++ b/src/interfaces/libpq/pqexpbuffer.c @@ -166,7 +166,7 @@ resetPQExpBuffer(PQExpBuffer str) * Make sure there is enough space for 'needed' more bytes in the buffer * ('needed' does not include the terminating null). * - * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case + * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case * the buffer is left in "broken" state.) */ int @@ -180,7 +180,7 @@ enlargePQExpBuffer(PQExpBuffer str, size_t needed) /* * Guard against ridiculous "needed" values, which can occur if we're fed - * bogus data. Without this, we can get an overflow or infinite loop in + * bogus data. Without this, we can get an overflow or infinite loop in * the following. */ if (needed >= ((size_t) INT_MAX - str->len)) @@ -207,7 +207,7 @@ enlargePQExpBuffer(PQExpBuffer str, size_t needed) /* * Clamp to INT_MAX in case we went past it. Note we are assuming here - * that INT_MAX <= UINT_MAX/2, else the above loop could overflow. We + * that INT_MAX <= UINT_MAX/2, else the above loop could overflow. We * will still have newlen >= needed. */ if (newlen > (size_t) INT_MAX) @@ -228,7 +228,7 @@ enlargePQExpBuffer(PQExpBuffer str, size_t needed) /* * printfPQExpBuffer * Format text data under the control of fmt (an sprintf-like format string) - * and insert it into str. More space is allocated to str if necessary. + * and insert it into str. More space is allocated to str if necessary. * This is a convenience routine that does the same thing as * resetPQExpBuffer() followed by appendPQExpBuffer(). */ @@ -319,7 +319,7 @@ appendPQExpBufferVA(PQExpBuffer str, const char *fmt, va_list args) /* * Note: some versions of vsnprintf return the number of chars * actually stored, not the total space needed as C99 specifies. And - * at least one returns -1 on failure. Be conservative about + * at least one returns -1 on failure. Be conservative about * believing whether the print worked. */ if (nprinted >= 0 && (size_t) nprinted < avail - 1) diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqexpbuffer.h index 4ebb124f556..b3c0c0fefb8 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -37,7 +37,7 @@ * more space. We must always have maxlen > len. * * An exception occurs if we failed to allocate enough memory for the string - * buffer. In that case data points to a statically allocated empty string, + * buffer. In that case data points to a statically allocated empty string, * and len = maxlen = 0. *------------------------- */ @@ -115,7 +115,7 @@ extern void initPQExpBuffer(PQExpBuffer str); * * NOTE: some routines build up a string using PQExpBuffer, and then * release the PQExpBufferData but return the data string itself to their - * caller. At that point the data string looks like a plain malloc'd + * caller. At that point the data string looks like a plain malloc'd * string. */ extern void destroyPQExpBuffer(PQExpBuffer str); @@ -134,7 +134,7 @@ extern void resetPQExpBuffer(PQExpBuffer str); * Make sure there is enough space for 'needed' more bytes in the buffer * ('needed' does not include the terminating null). * - * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case + * Returns 1 if OK, 0 if failed to enlarge buffer. (In the latter case * the buffer is left in "broken" state.) */ extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed); @@ -142,7 +142,7 @@ extern int enlargePQExpBuffer(PQExpBuffer str, size_t needed); /*------------------------ * printfPQExpBuffer * Format text data under the control of fmt (an sprintf-like format string) - * and insert it into str. More space is allocated to str if necessary. + * and insert it into str. More space is allocated to str if necessary. * This is a convenience routine that does the same thing as * resetPQExpBuffer() followed by appendPQExpBuffer(). */ diff --git a/src/interfaces/libpq/test/uri-regress.c b/src/interfaces/libpq/test/uri-regress.c index e08a69dc908..cf0ef135d53 100644 --- a/src/interfaces/libpq/test/uri-regress.c +++ b/src/interfaces/libpq/test/uri-regress.c @@ -2,7 +2,7 @@ * uri-regress.c * A test program for libpq URI format * - * This is a helper for libpq conninfo regression testing. It takes a single + * This is a helper for libpq conninfo regression testing. It takes a single * conninfo string as a parameter, parses it using PQconninfoParse, and then * prints out the values from the parsed PQconninfoOption struct that differ * from the defaults (obtained from PQconndefaults). |