diff options
Diffstat (limited to 'src/interfaces/libpq')
| -rw-r--r-- | src/interfaces/libpq/fe-auth.c | 18 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-auth.h | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-connect.c | 27 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-exec.c | 22 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-misc.c | 20 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-protocol2.c | 10 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-protocol3.c | 14 | ||||
| -rw-r--r-- | src/interfaces/libpq/libpq-fe.h | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/libpq-int.h | 30 | ||||
| -rw-r--r-- | src/interfaces/libpq/pthread-win32.h | 2 |
10 files changed, 75 insertions, 76 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index bca9f46830..95609114f9 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.107 2005/10/24 15:38:37 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.108 2005/11/22 18:17:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -278,7 +278,6 @@ pg_krb5_sendauth(char *PQerrormsg, int sock, const char *hostname, const char *s return ret; } - #endif /* KRB5 */ @@ -501,14 +500,13 @@ pg_fe_getauthname(char *PQerrormsg) #endif /* - * pglock_thread() really only needs to be called around - * pg_krb5_authname(), but some users are using configure - * --enable-thread-safety-force, so we might as well do - * the locking within our library to protect pqGetpwuid(). - * In fact, application developers can use getpwuid() - * in their application if they use the locking call we - * provide, or install their own locking function using - * PQregisterThreadLock(). + * pglock_thread() really only needs to be called around + * pg_krb5_authname(), but some users are using configure + * --enable-thread-safety-force, so we might as well do the locking within + * our library to protect pqGetpwuid(). In fact, application developers + * can use getpwuid() in their application if they use the locking call we + * provide, or install their own locking function using + * PQregisterThreadLock(). */ pglock_thread(); diff --git a/src/interfaces/libpq/fe-auth.h b/src/interfaces/libpq/fe-auth.h index 01b2fcc9d9..19e07ffafa 100644 --- a/src/interfaces/libpq/fe-auth.h +++ b/src/interfaces/libpq/fe-auth.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.h,v 1.23 2005/10/17 16:24:20 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.h,v 1.24 2005/11/22 18:17:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ extern int pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname, - const char *password, char *PQerrormsg); + const char *password, char *PQerrormsg); extern char *pg_fe_getauthname(char *PQerrormsg); #endif /* FE_AUTH_H */ diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index b378b65c82..8204a0e1b7 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.323 2005/10/17 16:24:20 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.324 2005/11/22 18:17:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -370,8 +370,8 @@ connectOptions1(PGconn *conn, const char *conninfo) /* * Move option values into conn structure * - * Don't put anything cute here --- intelligence should be in connectOptions2 - * ... + * Don't put anything cute here --- intelligence should be in + * connectOptions2 ... * * XXX: probably worth checking strdup() return value here... */ @@ -687,7 +687,7 @@ connectFailureMessage(PGconn *conn, int errorno) printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not connect to server: %s\n" "\tIs the server running locally and accepting\n" - "\tconnections on Unix domain socket \"%s\"?\n"), + "\tconnections on Unix domain socket \"%s\"?\n"), SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)), service); } @@ -1003,7 +1003,7 @@ keep_going: /* We will come back to here until there is /* * Try to initiate a connection to one of the addresses * returned by pg_getaddrinfo_all(). conn->addr_cur is the - * next one to try. We fail when we run out of addresses + * next one to try. We fail when we run out of addresses * (reporting the error returned for the *last* alternative, * which may not be what users expect :-(). */ @@ -1226,8 +1226,9 @@ keep_going: /* We will come back to here until there is /* * Send the SSL request packet. * - * Theoretically, this could block, but it really shouldn't - * since we only got here if the socket is write-ready. + * Theoretically, this could block, but it really + * shouldn't since we only got here if the socket is + * write-ready. */ pv = htonl(NEGOTIATE_SSL_CODE); if (pqPacketSend(conn, 0, &pv, sizeof(pv)) != STATUS_OK) @@ -1262,8 +1263,8 @@ keep_going: /* We will come back to here until there is /* * Send the startup packet. * - * Theoretically, this could block, but it really shouldn't since - * we only got here if the socket is write-ready. + * Theoretically, this could block, but it really shouldn't + * since we only got here if the socket is write-ready. */ if (pqPacketSend(conn, 0, startpacket, packetlen) != STATUS_OK) { @@ -1500,8 +1501,8 @@ keep_going: /* We will come back to here until there is /* * Can't process if message body isn't all here yet. * - * (In protocol 2.0 case, we are assuming messages carry at least - * 4 bytes of data.) + * (In protocol 2.0 case, we are assuming messages carry at + * least 4 bytes of data.) */ msgLength -= 4; avail = conn->inEnd - conn->inCursor; @@ -1829,8 +1830,8 @@ makeEmptyPGconn(void) * bufferloads. The output buffer is initially made 16K in size, and we * try to dump it after accumulating 8K. * - * With the same goal of minimizing context swaps, the input buffer will be - * enlarged anytime it has less than 8K free, so we initially allocate + * With the same goal of minimizing context swaps, the input buffer will + * be enlarged anytime it has less than 8K free, so we initially allocate * twice that. */ conn->inBufSize = 16 * 1024; diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 84637072bc..e355968e47 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.176 2005/10/15 02:49:48 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.177 2005/11/22 18:17:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -454,7 +454,7 @@ pqPrepareAsyncResult(PGconn *conn) * a trailing newline, and should not be more than one line). */ void -pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...) +pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) { char msgBuf[1024]; va_list args; @@ -505,20 +505,20 @@ pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...) * Returns TRUE if OK, FALSE if not enough memory to add the row */ int -pqAddTuple(PGresult *res, PGresAttValue * tup) +pqAddTuple(PGresult *res, PGresAttValue *tup) { if (res->ntups >= res->tupArrSize) { /* * Try to grow the array. * - * We can use realloc because shallow copying of the structure is okay. - * Note that the first time through, res->tuples is NULL. While ANSI - * says that realloc() should act like malloc() in that case, some old - * C libraries (like SunOS 4.1.x) coredump instead. On failure realloc - * is supposed to return NULL without damaging the existing - * allocation. Note that the positions beyond res->ntups are garbage, - * not necessarily NULL. + * We can use realloc because shallow copying of the structure is + * okay. Note that the first time through, res->tuples is NULL. While + * ANSI says that realloc() should act like malloc() in that case, + * some old C libraries (like SunOS 4.1.x) coredump instead. On + * failure realloc is supposed to return NULL without damaging the + * existing allocation. Note that the positions beyond res->ntups are + * garbage, not necessarily NULL. */ int newSize = (res->tupArrSize > 0) ? res->tupArrSize * 2 : 128; PGresAttValue **newTuples; @@ -594,7 +594,7 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value) * Store new info as a single malloc block */ pstatus = (pgParameterStatus *) malloc(sizeof(pgParameterStatus) + - strlen(name) + strlen(value) + 2); + strlen(name) +strlen(value) + 2); if (pstatus) { char *ptr; diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index c78d8b3c66..d2caf667cd 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.122 2005/10/15 02:49:48 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.123 2005/11/22 18:17:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -566,8 +566,8 @@ pqReadData(PGconn *conn) /* * 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 buffer entirely so as to avoid asking the + * the buffer in case a single message exceeds the initial buffer size. We + * enlarge before filling the buffer entirely so as to avoid asking the * kernel for a partial packet. The magic constant here should be large * enough for a TCP packet or Unix pipe bufferload. 8K is the usual pipe * buffer size, so... @@ -623,9 +623,9 @@ retry3: * 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 the - * message "long" once we have acquired 32k ... + * Since we left-justified the data above, conn->inEnd gives the + * amount of data already read in the current message. We consider + * the message "long" once we have acquired 32k ... */ if (conn->inEnd > 32768 && (conn->inBufSize - conn->inEnd) >= 8192) @@ -648,10 +648,10 @@ retry3: * since in normal practice we should not be trying to read data unless * the file selected for reading already. * - * In SSL mode it's even worse: SSL_read() could say WANT_READ and then data - * could arrive before we make the pqReadReady() test. So we must play - * dumb and assume there is more data, relying on the SSL layer to detect - * true EOF. + * In SSL mode it's even worse: SSL_read() could say WANT_READ and then + * data could arrive before we make the pqReadReady() test. So we must + * play dumb and assume there is more data, relying on the SSL layer to + * detect true EOF. */ #ifdef USE_SSL diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c index 8e3614ac07..22d1863993 100644 --- a/src/interfaces/libpq/fe-protocol2.c +++ b/src/interfaces/libpq/fe-protocol2.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.19 2005/10/15 02:49:48 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.20 2005/11/22 18:17:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -379,9 +379,9 @@ pqParseInput2(PGconn *conn) * NOTIFY and NOTICE messages can happen in any state besides COPY * OUT; always process them right away. * - * Most other messages should only be processed while in BUSY state. (In - * particular, in READY state we hold off further parsing until the - * application collects the current PGresult.) + * Most other messages should only be processed while in BUSY state. + * (In particular, in READY state we hold off further parsing until + * the application collects the current PGresult.) * * However, if the state is IDLE then we got trouble; we need to deal * with the unexpected message somehow. @@ -1420,7 +1420,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid, */ char * pqBuildStartupPacket2(PGconn *conn, int *packetlen, - const PQEnvironmentOption * options) + const PQEnvironmentOption *options) { StartupPacket *startpacket; diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index d3af5ad447..80780900db 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.22 2005/10/15 02:49:48 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.23 2005/11/22 18:17:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ static int getNotify(PGconn *conn); static int getCopyStart(PGconn *conn, ExecStatusType copytype); static int getReadyForQuery(PGconn *conn); static int build_startup_packet(const PGconn *conn, char *packet, - const PQEnvironmentOption * options); + const PQEnvironmentOption *options); /* @@ -130,9 +130,9 @@ pqParseInput3(PGconn *conn) * NOTIFY and NOTICE messages can happen in any state; always process * them right away. * - * Most other messages should only be processed while in BUSY state. (In - * particular, in READY state we hold off further parsing until the - * application collects the current PGresult.) + * Most other messages should only be processed while in BUSY state. + * (In particular, in READY state we hold off further parsing until + * the application collects the current PGresult.) * * However, if the state is IDLE then we got trouble; we need to deal * with the unexpected message somehow. @@ -1430,7 +1430,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid, */ char * pqBuildStartupPacket3(PGconn *conn, int *packetlen, - const PQEnvironmentOption * options) + const PQEnvironmentOption *options) { char *startpacket; @@ -1453,7 +1453,7 @@ pqBuildStartupPacket3(PGconn *conn, int *packetlen, */ static int build_startup_packet(const PGconn *conn, char *packet, - const PQEnvironmentOption * options) + const PQEnvironmentOption *options) { int packet_len = 0; const PQEnvironmentOption *next_eo; diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index a26721e9f6..7f1d1e9fc3 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.120 2005/10/15 02:49:48 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.121 2005/11/22 18:17:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,7 +35,7 @@ extern "C" /* Application-visible enum types */ -typedef enum + typedef enum { /* * Although it is okay to add to this list, values which become unused diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index d2ee44753b..096ee1b7af 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.108 2005/10/15 02:49:49 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.109 2005/11/22 18:17:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -92,7 +92,7 @@ typedef struct pgresAttDesc Oid typid; /* type id */ int typlen; /* type size */ int atttypmod; /* type-specific modifier info */ -} PGresAttDesc; +} PGresAttDesc; /* * Data for a single attribute of a single tuple @@ -118,7 +118,7 @@ typedef struct pgresAttValue { int len; /* length in bytes of the value */ char *value; /* actual value, plus terminating zero byte */ -} PGresAttValue; +} PGresAttValue; /* Typedef for message-field list entries */ typedef struct pgMessageField @@ -126,7 +126,7 @@ typedef struct pgMessageField struct pgMessageField *next; /* list link */ char code; /* field code */ char contents[1]; /* field value (VARIABLE LENGTH) */ -} PGMessageField; +} PGMessageField; /* Fields needed for notice handling */ typedef struct @@ -135,7 +135,7 @@ typedef struct void *noticeRecArg; PQnoticeProcessor noticeProc; /* notice message processor */ void *noticeProcArg; -} PGNoticeHooks; +} PGNoticeHooks; struct pg_result { @@ -186,7 +186,7 @@ typedef enum PGASYNC_READY, /* result ready for PQgetResult */ PGASYNC_COPY_IN, /* Copy In data transfer in progress */ PGASYNC_COPY_OUT /* Copy Out data transfer in progress */ -} PGAsyncStatusType; +} PGAsyncStatusType; /* PGQueryClass tracks which query protocol we are now executing */ typedef enum @@ -194,7 +194,7 @@ typedef enum PGQUERY_SIMPLE, /* simple Query protocol (PQexec) */ PGQUERY_EXTENDED, /* full Extended protocol (PQexecParams) */ PGQUERY_PREPARE /* Parse only (PQprepare) */ -} PGQueryClass; +} PGQueryClass; /* PGSetenvStatusType defines the state of the PQSetenv state machine */ /* (this is used only for 2.0-protocol connections) */ @@ -207,14 +207,14 @@ typedef enum SETENV_STATE_QUERY2_SEND, /* About to send a status query */ SETENV_STATE_QUERY2_WAIT, /* Waiting for query to complete */ SETENV_STATE_IDLE -} PGSetenvStatusType; +} PGSetenvStatusType; /* Typedef for the EnvironmentOptions[] array */ typedef struct PQEnvironmentOption { const char *envName, /* name of an environment variable */ *pgName; /* name of corresponding SET variable */ -} PQEnvironmentOption; +} PQEnvironmentOption; /* Typedef for parameter-status list entries */ typedef struct pgParameterStatus @@ -223,7 +223,7 @@ typedef struct pgParameterStatus char *name; /* parameter name */ char *value; /* parameter value */ /* Note: name and value are stored in same malloc block as struct is */ -} pgParameterStatus; +} pgParameterStatus; /* large-object-access data ... allocated only if large-object code is used. */ typedef struct pgLobjfuncs @@ -237,7 +237,7 @@ typedef struct pgLobjfuncs Oid fn_lo_tell; /* OID of backend function lo_tell */ Oid fn_lo_read; /* OID of backend function LOread */ Oid fn_lo_write; /* OID of backend function LOwrite */ -} PGlobjfuncs; +} PGlobjfuncs; /* * PGconn stores all the state data associated with a single connection @@ -402,10 +402,10 @@ extern void pqClearAsyncResult(PGconn *conn); extern void pqSaveErrorResult(PGconn *conn); extern PGresult *pqPrepareAsyncResult(PGconn *conn); extern void -pqInternalNotice(const PGNoticeHooks * hooks, const char *fmt,...) +pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) /* This lets gcc check the format string for consistency. */ __attribute__((format(printf, 2, 3))); -extern int pqAddTuple(PGresult *res, PGresAttValue * tup); +extern int pqAddTuple(PGresult *res, PGresAttValue *tup); extern void pqSaveMessageField(PGresult *res, char code, const char *value); extern void pqSaveParameterStatus(PGconn *conn, const char *name, @@ -417,7 +417,7 @@ extern void pqHandleSendFailure(PGconn *conn); extern PostgresPollingStatusType pqSetenvPoll(PGconn *conn); extern char *pqBuildStartupPacket2(PGconn *conn, int *packetlen, - const PQEnvironmentOption * options); + const PQEnvironmentOption *options); extern void pqParseInput2(PGconn *conn); extern int pqGetCopyData2(PGconn *conn, char **buffer, int async); extern int pqGetline2(PGconn *conn, char *s, int maxlen); @@ -431,7 +431,7 @@ extern PGresult *pqFunctionCall2(PGconn *conn, Oid fnid, /* === in fe-protocol3.c === */ extern char *pqBuildStartupPacket3(PGconn *conn, int *packetlen, - const PQEnvironmentOption * options); + const PQEnvironmentOption *options); extern void pqParseInput3(PGconn *conn); extern int pqGetErrorNotice3(PGconn *conn, bool isError); extern int pqGetCopyData3(PGconn *conn, char **buffer, int async); diff --git a/src/interfaces/libpq/pthread-win32.h b/src/interfaces/libpq/pthread-win32.h index c30eaeb291..dfcdd328ec 100644 --- a/src/interfaces/libpq/pthread-win32.h +++ b/src/interfaces/libpq/pthread-win32.h @@ -13,7 +13,7 @@ void *pthread_getspecific(pthread_key_t); void pthread_mutex_init(pthread_mutex_t *, void *attr); void pthread_mutex_lock(pthread_mutex_t *); -//blocking +/* blocking */ void pthread_mutex_unlock(pthread_mutex_t *); #endif |
