mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.141 2009/03/22 18:06:35 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.142 2009/06/11 14:49:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -580,13 +580,14 @@ pg_SSPI_continue(PGconn *conn)
|
||||
}
|
||||
|
||||
/*
|
||||
* If the negotiation is complete, there may be zero bytes to send. The server is
|
||||
* at this point not expecting any more data, so don't send it.
|
||||
* If the negotiation is complete, there may be zero bytes to send.
|
||||
* The server is at this point not expecting any more data, so don't
|
||||
* send it.
|
||||
*/
|
||||
if (outbuf.pBuffers[0].cbBuffer > 0)
|
||||
{
|
||||
if (pqPacketSend(conn, 'p',
|
||||
outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer))
|
||||
outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer))
|
||||
{
|
||||
FreeContextBuffer(outbuf.pBuffers[0].pvBuffer);
|
||||
return STATUS_ERROR;
|
||||
@@ -914,7 +915,7 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn)
|
||||
|
||||
case AUTH_REQ_CRYPT:
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("Crypt authentication not supported\n"));
|
||||
libpq_gettext("Crypt authentication not supported\n"));
|
||||
return STATUS_ERROR;
|
||||
|
||||
case AUTH_REQ_MD5:
|
||||
@@ -971,12 +972,11 @@ pg_fe_getauthname(PQExpBuffer errorMessage)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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().
|
||||
* 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();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.374 2009/05/18 16:15:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.375 2009/06/11 14:49:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -176,9 +176,9 @@ static const PQconninfoOption PQconninfoOptions[] = {
|
||||
|
||||
/*
|
||||
* ssl options are allowed even without client SSL support because the
|
||||
* client can still handle SSL modes "disable" and "allow". Other parameters
|
||||
* have no effect on non-SSL connections, so there is no reason to exclude them
|
||||
* since none of them are mandatory.
|
||||
* client can still handle SSL modes "disable" and "allow". Other
|
||||
* parameters have no effect on non-SSL connections, so there is no reason
|
||||
* to exclude them since none of them are mandatory.
|
||||
*/
|
||||
{"sslmode", "PGSSLMODE", DefaultSSLMode, NULL,
|
||||
"SSL-Mode", "", 8}, /* sizeof("disable") == 8 */
|
||||
@@ -566,7 +566,7 @@ connectOptions2(PGconn *conn)
|
||||
*
|
||||
* Parse an empty string like PQconnectdb() would do and return the
|
||||
* resulting connection options array, ie, all the default values that are
|
||||
* available from the environment etc. On error (eg out of memory),
|
||||
* available from the environment etc. On error (eg out of memory),
|
||||
* NULL is returned.
|
||||
*
|
||||
* Using this function, an application may determine all possible options
|
||||
@@ -949,7 +949,11 @@ connectDBComplete(PGconn *conn)
|
||||
switch (flag)
|
||||
{
|
||||
case PGRES_POLLING_OK:
|
||||
/* Reset stored error messages since we now have a working connection */
|
||||
|
||||
/*
|
||||
* Reset stored error messages since we now have a working
|
||||
* connection
|
||||
*/
|
||||
resetPQExpBuffer(&conn->errorMessage);
|
||||
return 1; /* success! */
|
||||
|
||||
@@ -1330,7 +1334,10 @@ keep_going: /* We will come back to here until there is
|
||||
EnvironmentOptions);
|
||||
if (!startpacket)
|
||||
{
|
||||
/* will not appendbuffer here, since it's likely to also run out of memory */
|
||||
/*
|
||||
* will not appendbuffer here, since it's likely to also
|
||||
* run out of memory
|
||||
*/
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("out of memory\n"));
|
||||
goto error_return;
|
||||
@@ -1407,7 +1414,8 @@ keep_going: /* We will come back to here until there is
|
||||
else if (SSLok == 'N')
|
||||
{
|
||||
if (conn->sslmode[0] == 'r' || /* "require" */
|
||||
conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */
|
||||
conn->sslmode[0] == 'v') /* "verify-ca" or
|
||||
* "verify-full" */
|
||||
{
|
||||
/* Require SSL, but server does not want it */
|
||||
appendPQExpBuffer(&conn->errorMessage,
|
||||
@@ -1425,7 +1433,8 @@ keep_going: /* We will come back to here until there is
|
||||
if (conn->Pfdebug)
|
||||
fprintf(conn->Pfdebug, "received error from server, attempting fallback to pre-7.0\n");
|
||||
if (conn->sslmode[0] == 'r' || /* "require" */
|
||||
conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */
|
||||
conn->sslmode[0] == 'v') /* "verify-ca" or
|
||||
* "verify-full" */
|
||||
{
|
||||
/* Require SSL, but server is too old */
|
||||
appendPQExpBuffer(&conn->errorMessage,
|
||||
@@ -2070,7 +2079,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
|
||||
@@ -2206,10 +2215,10 @@ PQreset(PGconn *conn)
|
||||
if (connectDBStart(conn) && connectDBComplete(conn))
|
||||
{
|
||||
/*
|
||||
* Notify event procs of successful reset. We treat an event
|
||||
* proc failure as disabling the connection ... good idea?
|
||||
* Notify event procs of successful reset. We treat an event proc
|
||||
* failure as disabling the connection ... good idea?
|
||||
*/
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < conn->nEvents; i++)
|
||||
{
|
||||
@@ -2266,10 +2275,10 @@ PQresetPoll(PGconn *conn)
|
||||
if (status == PGRES_POLLING_OK)
|
||||
{
|
||||
/*
|
||||
* Notify event procs of successful reset. We treat an event
|
||||
* proc failure as disabling the connection ... good idea?
|
||||
* Notify event procs of successful reset. We treat an event proc
|
||||
* failure as disabling the connection ... good idea?
|
||||
*/
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < conn->nEvents; i++)
|
||||
{
|
||||
@@ -3139,7 +3148,7 @@ parseServiceInfo(PQconninfoOption *options, PQExpBuffer errorMessage)
|
||||
* 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.
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.202 2009/05/27 14:16:51 meskes Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.203 2009/06/11 14:49:13 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ static bool PQexecStart(PGconn *conn);
|
||||
static PGresult *PQexecFinish(PGconn *conn);
|
||||
static int PQsendDescribe(PGconn *conn, char desc_type,
|
||||
const char *desc_target);
|
||||
static int check_field_number(const PGresult *res, int field_num);
|
||||
static int check_field_number(const PGresult *res, int field_num);
|
||||
|
||||
|
||||
/* ----------------
|
||||
@@ -218,7 +218,7 @@ PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status)
|
||||
int
|
||||
PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
/* If attrs already exist, they cannot be overwritten. */
|
||||
if (!res || res->numAttributes > 0)
|
||||
@@ -262,29 +262,29 @@ 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.
|
||||
*
|
||||
* Options:
|
||||
* PG_COPYRES_ATTRS - Copy the source result's attributes
|
||||
* PG_COPYRES_ATTRS - Copy the source result's attributes
|
||||
*
|
||||
* PG_COPYRES_TUPLES - Copy the source result's tuples. This implies
|
||||
* copying the attrs, seeeing how the attrs are needed by the tuples.
|
||||
* PG_COPYRES_TUPLES - Copy the source result's tuples. This implies
|
||||
* copying the attrs, seeeing how the attrs are needed by the tuples.
|
||||
*
|
||||
* PG_COPYRES_EVENTS - Copy the source result's events.
|
||||
* PG_COPYRES_EVENTS - Copy the source result's events.
|
||||
*
|
||||
* PG_COPYRES_NOTICEHOOKS - Copy the source result's notice hooks.
|
||||
* PG_COPYRES_NOTICEHOOKS - Copy the source result's notice hooks.
|
||||
*/
|
||||
PGresult *
|
||||
PQcopyResult(const PGresult *src, int flags)
|
||||
{
|
||||
PGresult *dest;
|
||||
int i;
|
||||
PGresult *dest;
|
||||
int i;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
@@ -293,7 +293,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);
|
||||
|
||||
@@ -310,7 +310,8 @@ PQcopyResult(const PGresult *src, int flags)
|
||||
/* Wants to copy tuples? */
|
||||
if (flags & PG_COPYRES_TUPLES)
|
||||
{
|
||||
int tup, field;
|
||||
int tup,
|
||||
field;
|
||||
|
||||
for (tup = 0; tup < src->ntups; tup++)
|
||||
{
|
||||
@@ -373,8 +374,8 @@ PQcopyResult(const PGresult *src, int flags)
|
||||
static PGEvent *
|
||||
dupEvents(PGEvent *events, int count)
|
||||
{
|
||||
PGEvent *newEvents;
|
||||
int i;
|
||||
PGEvent *newEvents;
|
||||
int i;
|
||||
|
||||
if (!events || count <= 0)
|
||||
return NULL;
|
||||
@@ -424,7 +425,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
|
||||
/* need to grow the tuple table? */
|
||||
if (res->ntups >= res->tupArrSize)
|
||||
{
|
||||
int n = res->tupArrSize ? res->tupArrSize * 2 : 128;
|
||||
int n = res->tupArrSize ? res->tupArrSize * 2 : 128;
|
||||
PGresAttValue **tups;
|
||||
|
||||
if (res->tuples)
|
||||
@@ -445,7 +446,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
|
||||
if (tup_num == res->ntups && !res->tuples[tup_num])
|
||||
{
|
||||
PGresAttValue *tup;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
tup = (PGresAttValue *)
|
||||
pqResultAlloc(res, res->numAttributes * sizeof(PGresAttValue),
|
||||
@@ -661,7 +662,7 @@ void
|
||||
PQclear(PGresult *res)
|
||||
{
|
||||
PGresult_data *block;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!res)
|
||||
return;
|
||||
@@ -1600,7 +1601,7 @@ PQgetResult(PGconn *conn)
|
||||
|
||||
if (res)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < res->nEvents; i++)
|
||||
{
|
||||
@@ -3115,7 +3116,7 @@ PQescapeByteaInternal(PGconn *conn,
|
||||
{
|
||||
if (*vp < 0x20 || *vp > 0x7e)
|
||||
{
|
||||
int val = *vp;
|
||||
int val = *vp;
|
||||
|
||||
if (!std_strings)
|
||||
*rp++ = '\\';
|
||||
@@ -3219,11 +3220,11 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
|
||||
(ISOCTDIGIT(strtext[i + 1])) &&
|
||||
(ISOCTDIGIT(strtext[i + 2])))
|
||||
{
|
||||
int byte;
|
||||
int byte;
|
||||
|
||||
byte = OCTVAL(strtext[i++]);
|
||||
byte = (byte << 3) + OCTVAL(strtext[i++]);
|
||||
byte = (byte << 3) + OCTVAL(strtext[i++]);
|
||||
byte = (byte <<3) +OCTVAL(strtext[i++]);
|
||||
byte = (byte <<3) +OCTVAL(strtext[i++]);
|
||||
buffer[j++] = byte;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.67 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.68 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,7 +42,7 @@
|
||||
static int lo_initialize(PGconn *conn);
|
||||
|
||||
static Oid
|
||||
lo_import_internal(PGconn *conn, const char *filename, const Oid oid);
|
||||
lo_import_internal(PGconn *conn, const char *filename, const Oid oid);
|
||||
|
||||
/*
|
||||
* lo_open
|
||||
|
||||
@@ -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.139 2009/05/21 12:54:27 meskes Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.140 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -769,10 +769,11 @@ pqSendSome(PGconn *conn, int len)
|
||||
#ifndef WIN32
|
||||
sent = pqsecure_write(conn, ptr, len);
|
||||
#else
|
||||
|
||||
/*
|
||||
* Windows can fail on large sends, per KB article Q201213. The failure-point
|
||||
* appears to be different in different versions of Windows, but 64k should
|
||||
* always be safe.
|
||||
* Windows can fail on large sends, per KB article Q201213. The
|
||||
* failure-point appears to be different in different versions of
|
||||
* Windows, but 64k should always be safe.
|
||||
*/
|
||||
sent = pqsecure_write(conn, ptr, Min(len, 65536));
|
||||
#endif
|
||||
@@ -1073,10 +1074,11 @@ pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time)
|
||||
FD_ZERO(&output_mask);
|
||||
FD_ZERO(&except_mask);
|
||||
if (forRead)
|
||||
FD_SET(sock, &input_mask);
|
||||
FD_SET (sock, &input_mask);
|
||||
|
||||
if (forWrite)
|
||||
FD_SET(sock, &output_mask);
|
||||
FD_SET(sock, &except_mask);
|
||||
FD_SET (sock, &output_mask);
|
||||
FD_SET (sock, &except_mask);
|
||||
|
||||
/* Compute appropriate timeout interval */
|
||||
if (end_time == ((time_t) -1))
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.38 2009/01/09 18:50:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.39 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -309,7 +309,7 @@ pqParseInput3(PGconn *conn)
|
||||
if (conn->result == NULL)
|
||||
{
|
||||
conn->result = PQmakeEmptyPGresult(conn,
|
||||
PGRES_COMMAND_OK);
|
||||
PGRES_COMMAND_OK);
|
||||
if (!conn->result)
|
||||
return;
|
||||
}
|
||||
@@ -1378,7 +1378,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.
|
||||
*/
|
||||
@@ -1387,13 +1387,13 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
|
||||
{
|
||||
/*
|
||||
* On end-of-copy, exit COPY_OUT mode and let caller read status
|
||||
* with PQgetResult(). The normal case is that it's Copy Done,
|
||||
* but we let parseInput read that. If error, we expect the
|
||||
* state was already changed.
|
||||
* with PQgetResult(). The normal case is that it's Copy Done,
|
||||
* but we let parseInput read that. If error, we expect the state
|
||||
* was already changed.
|
||||
*/
|
||||
if (msgLength == -1)
|
||||
conn->asyncStatus = PGASYNC_BUSY;
|
||||
return msgLength; /* end-of-copy or error */
|
||||
return msgLength; /* end-of-copy or error */
|
||||
}
|
||||
if (msgLength == 0)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.125 2009/05/03 17:16:58 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.126 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -111,10 +111,8 @@ static pthread_mutex_t ssl_config_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_mutex_t ssl_config_mutex = NULL;
|
||||
static long win32_ssl_create_mutex = 0;
|
||||
#endif
|
||||
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
|
||||
#endif /* SSL */
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
#endif /* SSL */
|
||||
|
||||
|
||||
/*
|
||||
@@ -141,8 +139,7 @@ static long win32_ssl_create_mutex = 0;
|
||||
|
||||
#define RESTORE_SIGPIPE() \
|
||||
pq_reset_sigpipe(&osigmask, sigpipe_pending, got_epipe)
|
||||
|
||||
#else /* !ENABLE_THREAD_SAFETY */
|
||||
#else /* !ENABLE_THREAD_SAFETY */
|
||||
|
||||
#define DISABLE_SIGPIPE(failaction) \
|
||||
pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN)
|
||||
@@ -151,15 +148,13 @@ static long win32_ssl_create_mutex = 0;
|
||||
|
||||
#define RESTORE_SIGPIPE() \
|
||||
pqsignal(SIGPIPE, oldsighandler)
|
||||
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
#else /* WIN32 */
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
#else /* WIN32 */
|
||||
|
||||
#define DISABLE_SIGPIPE(failaction)
|
||||
#define REMEMBER_EPIPE(cond)
|
||||
#define RESTORE_SIGPIPE()
|
||||
|
||||
#endif /* WIN32 */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* Procedures common to all secure sessions */
|
||||
@@ -180,14 +175,15 @@ PQinitSSL(int do_init)
|
||||
* Exported function to allow application to tell us it's already
|
||||
* initialized OpenSSL and/or libcrypto.
|
||||
*/
|
||||
void
|
||||
void
|
||||
PQinitOpenSSL(int do_ssl, int do_crypto)
|
||||
{
|
||||
#ifdef USE_SSL
|
||||
#ifdef ENABLE_THREAD_SAFETY
|
||||
|
||||
/*
|
||||
* Disallow changing the flags while we have open connections, else
|
||||
* we'd get completely confused.
|
||||
* Disallow changing the flags while we have open connections, else we'd
|
||||
* get completely confused.
|
||||
*/
|
||||
if (ssl_open_connections != 0)
|
||||
return;
|
||||
@@ -473,11 +469,11 @@ verify_cb(int ok, X509_STORE_CTX *ctx)
|
||||
* Check if a wildcard certificate matches the server hostname.
|
||||
*
|
||||
* The rule for this is:
|
||||
* 1. We only match the '*' character as wildcard
|
||||
* 2. We match only wildcards at the start of the string
|
||||
* 3. The '*' character does *not* match '.', meaning that we match only
|
||||
* a single pathname component.
|
||||
* 4. We don't support more than one '*' in a single pattern.
|
||||
* 1. We only match the '*' character as wildcard
|
||||
* 2. We match only wildcards at the start of the string
|
||||
* 3. The '*' character does *not* match '.', meaning that we match only
|
||||
* a single pathname component.
|
||||
* 4. We don't support more than one '*' in a single pattern.
|
||||
*
|
||||
* This is roughly in line with RFC2818, but contrary to what most browsers
|
||||
* appear to be implementing (point 3 being the difference)
|
||||
@@ -487,8 +483,8 @@ verify_cb(int ok, X509_STORE_CTX *ctx)
|
||||
static int
|
||||
wildcard_certificate_match(const char *pattern, const char *string)
|
||||
{
|
||||
int lenpat = strlen(pattern);
|
||||
int lenstr = strlen(string);
|
||||
int lenpat = strlen(pattern);
|
||||
int lenstr = strlen(string);
|
||||
|
||||
/* If we don't start with a wildcard, it's not a match (rule 1 & 2) */
|
||||
if (lenpat < 3 ||
|
||||
@@ -500,12 +496,20 @@ wildcard_certificate_match(const char *pattern, const char *string)
|
||||
/* If pattern is longer than the string, we can never match */
|
||||
return 0;
|
||||
|
||||
if (pg_strcasecmp(pattern+1, string+lenstr-lenpat+1) != 0)
|
||||
/* If string does not end in pattern (minus the wildcard), we don't match */
|
||||
if (pg_strcasecmp(pattern + 1, string + lenstr - lenpat + 1) != 0)
|
||||
|
||||
/*
|
||||
* If string does not end in pattern (minus the wildcard), we don't
|
||||
* match
|
||||
*/
|
||||
return 0;
|
||||
|
||||
if (strchr(string, '.') < string+lenstr-lenpat)
|
||||
/* If there is a dot left of where the pattern started to match, we don't match (rule 3) */
|
||||
if (strchr(string, '.') < string + lenstr - lenpat)
|
||||
|
||||
/*
|
||||
* If there is a dot left of where the pattern started to match, we
|
||||
* don't match (rule 3)
|
||||
*/
|
||||
return 0;
|
||||
|
||||
/* String ended with pattern, and didn't have a dot before, so we match */
|
||||
@@ -520,8 +524,8 @@ static bool
|
||||
verify_peer_name_matches_certificate(PGconn *conn)
|
||||
{
|
||||
/*
|
||||
* If told not to verify the peer name, don't do it. Return
|
||||
* 0 indicating that the verification was successful.
|
||||
* If told not to verify the peer name, don't do it. Return 0 indicating
|
||||
* that the verification was successful.
|
||||
*/
|
||||
if (strcmp(conn->sslmode, "verify-full") != 0)
|
||||
return true;
|
||||
@@ -650,10 +654,10 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
|
||||
BIO_free(bio);
|
||||
|
||||
/*
|
||||
* Read the SSL key. If a key is specified, treat it as an engine:key combination
|
||||
* if there is colon present - we don't support files with colon in the name. The
|
||||
* exception is if the second character is a colon, in which case it can be a Windows
|
||||
* filename with drive specification.
|
||||
* Read the SSL key. If a key is specified, treat it as an engine:key
|
||||
* combination if there is colon present - we don't support files with
|
||||
* colon in the name. The exception is if the second character is a colon,
|
||||
* in which case it can be a Windows filename with drive specification.
|
||||
*/
|
||||
if (conn->sslkey && strlen(conn->sslkey) > 0)
|
||||
{
|
||||
@@ -662,15 +666,15 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
|
||||
#ifdef WIN32
|
||||
&& conn->sslkey[1] != ':'
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
/* Colon, but not in second character, treat as engine:key */
|
||||
ENGINE *engine_ptr;
|
||||
char *engine_str = strdup(conn->sslkey);
|
||||
char *engine_colon = strchr(engine_str, ':');
|
||||
|
||||
*engine_colon = '\0'; /* engine_str now has engine name */
|
||||
engine_colon++; /* engine_colon now has key name */
|
||||
*engine_colon = '\0'; /* engine_str now has engine name */
|
||||
engine_colon++; /* engine_colon now has key name */
|
||||
|
||||
engine_ptr = ENGINE_by_id(engine_str);
|
||||
if (engine_ptr == NULL)
|
||||
@@ -678,7 +682,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
|
||||
char *err = SSLerrmessage();
|
||||
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("could not load SSL engine \"%s\": %s\n"),
|
||||
libpq_gettext("could not load SSL engine \"%s\": %s\n"),
|
||||
engine_str, err);
|
||||
SSLerrfree(err);
|
||||
free(engine_str);
|
||||
@@ -702,10 +706,11 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
|
||||
}
|
||||
free(engine_str);
|
||||
|
||||
fnbuf[0] = '\0'; /* indicate we're not going to load from a file */
|
||||
fnbuf[0] = '\0'; /* indicate we're not going to load from a
|
||||
* file */
|
||||
}
|
||||
else
|
||||
#endif /* support for SSL engines */
|
||||
#endif /* support for SSL engines */
|
||||
{
|
||||
/* PGSSLKEY is not an engine, treat it as a filename */
|
||||
strncpy(fnbuf, conn->sslkey, sizeof(fnbuf));
|
||||
@@ -733,7 +738,7 @@ client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
|
||||
if (!S_ISREG(buf.st_mode) || buf.st_mode & (S_IRWXG | S_IRWXO))
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("private key file \"%s\" has group or world access; permissions should be u=rw (0600) or less\n"),
|
||||
libpq_gettext("private key file \"%s\" has group or world access; permissions should be u=rw (0600) or less\n"),
|
||||
fnbuf);
|
||||
ERR_pop_to_mark();
|
||||
return 0;
|
||||
@@ -869,7 +874,7 @@ init_ssl_system(PGconn *conn)
|
||||
*/
|
||||
if (pq_lockarray == NULL)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
pq_lockarray = malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks());
|
||||
if (!pq_lockarray)
|
||||
@@ -896,7 +901,7 @@ init_ssl_system(PGconn *conn)
|
||||
CRYPTO_set_locking_callback(pq_lockingcallback);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
#endif /* ENABLE_THREAD_SAFETY */
|
||||
|
||||
if (!SSL_context)
|
||||
{
|
||||
@@ -959,12 +964,11 @@ destroy_ssl_system(void)
|
||||
CRYPTO_set_id_callback(NULL);
|
||||
|
||||
/*
|
||||
* We don't free the lock array. If we get another connection
|
||||
* in this process, we will just re-use it with the existing
|
||||
* mutexes.
|
||||
* We don't free the lock array. If we get another connection in this
|
||||
* process, we will just re-use it with the existing mutexes.
|
||||
*
|
||||
* This means we leak a little memory on repeated load/unload
|
||||
* of the library.
|
||||
* This means we leak a little memory on repeated load/unload of the
|
||||
* library.
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -991,15 +995,16 @@ initialize_SSL(PGconn *conn)
|
||||
* verification. If set to "verify-full" we will also do further
|
||||
* verification after the connection has been completed.
|
||||
*
|
||||
* If we are going to look for either root certificate or CRL in the home directory,
|
||||
* we need pqGetHomeDirectory() to succeed. In other cases, we don't need to
|
||||
* get the home directory explicitly.
|
||||
* If we are going to look for either root certificate or CRL in the home
|
||||
* directory, we need pqGetHomeDirectory() to succeed. In other cases, we
|
||||
* don't need to get the home directory explicitly.
|
||||
*/
|
||||
if (!conn->sslrootcert || !conn->sslcrl)
|
||||
{
|
||||
if (!pqGetHomeDirectory(homedir, sizeof(homedir)))
|
||||
{
|
||||
if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */
|
||||
if (conn->sslmode[0] == 'v') /* "verify-ca" or
|
||||
* "verify-full" */
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("could not get home directory to locate root certificate file"));
|
||||
@@ -1044,7 +1049,7 @@ initialize_SSL(PGconn *conn)
|
||||
/* 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_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
|
||||
/* if not found, silently ignore; we do not require CRL */
|
||||
#else
|
||||
{
|
||||
@@ -1064,10 +1069,10 @@ initialize_SSL(PGconn *conn)
|
||||
else
|
||||
{
|
||||
/* stat() failed; assume cert file doesn't exist */
|
||||
if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */
|
||||
if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("root certificate file \"%s\" does not exist\n"
|
||||
libpq_gettext("root certificate file \"%s\" does not exist\n"
|
||||
"Either provide the file or change sslmode to disable server certificate verification.\n"), fnbuf);
|
||||
return -1;
|
||||
}
|
||||
@@ -1153,8 +1158,8 @@ open_client_SSL(PGconn *conn)
|
||||
}
|
||||
|
||||
/*
|
||||
* We already checked the server certificate in initialize_SSL()
|
||||
* using SSL_CTX_set_verify() if root.crt exists.
|
||||
* We already checked the server certificate in initialize_SSL() using
|
||||
* SSL_CTX_set_verify() if root.crt exists.
|
||||
*/
|
||||
|
||||
/* pull out server distinguished and common names */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.c,v 1.4 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.c,v 1.5 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ int
|
||||
PQregisterEventProc(PGconn *conn, PGEventProc proc,
|
||||
const char *name, void *passThrough)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
PGEventRegister regevt;
|
||||
|
||||
if (!proc || !conn || !name || !*name)
|
||||
@@ -54,8 +54,8 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc,
|
||||
|
||||
if (conn->nEvents >= conn->eventArraySize)
|
||||
{
|
||||
PGEvent *e;
|
||||
int newSize;
|
||||
PGEvent *e;
|
||||
int newSize;
|
||||
|
||||
newSize = conn->eventArraySize ? conn->eventArraySize * 2 : 8;
|
||||
if (conn->events)
|
||||
@@ -97,7 +97,7 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc,
|
||||
int
|
||||
PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!conn || !proc)
|
||||
return FALSE;
|
||||
@@ -120,7 +120,7 @@ PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data)
|
||||
void *
|
||||
PQinstanceData(const PGconn *conn, PGEventProc proc)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!conn || !proc)
|
||||
return NULL;
|
||||
@@ -141,7 +141,7 @@ PQinstanceData(const PGconn *conn, PGEventProc proc)
|
||||
int
|
||||
PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!result || !proc)
|
||||
return FALSE;
|
||||
@@ -164,7 +164,7 @@ PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data)
|
||||
void *
|
||||
PQresultInstanceData(const PGresult *result, PGEventProc proc)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!result || !proc)
|
||||
return NULL;
|
||||
@@ -184,7 +184,7 @@ PQresultInstanceData(const PGresult *result, PGEventProc proc)
|
||||
int
|
||||
PQfireResultCreateEvents(PGconn *conn, PGresult *res)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!res)
|
||||
return FALSE;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.h,v 1.3 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-events.h,v 1.4 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ extern "C"
|
||||
#endif
|
||||
|
||||
/* Callback Event Ids */
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
PGEVT_REGISTER,
|
||||
PGEVT_CONNRESET,
|
||||
@@ -36,41 +36,41 @@ typedef enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PGconn *conn;
|
||||
PGconn *conn;
|
||||
} PGEventRegister;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PGconn *conn;
|
||||
PGconn *conn;
|
||||
} PGEventConnReset;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PGconn *conn;
|
||||
PGconn *conn;
|
||||
} PGEventConnDestroy;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
PGconn *conn;
|
||||
PGresult *result;
|
||||
} PGEventResultCreate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const PGresult *src;
|
||||
PGresult *dest;
|
||||
PGresult *dest;
|
||||
} PGEventResultCopy;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PGresult *result;
|
||||
PGresult *result;
|
||||
} PGEventResultDestroy;
|
||||
|
||||
typedef int (*PGEventProc) (PGEventId evtId, void *evtInfo, void *passThrough);
|
||||
|
||||
/* Registers an event proc with the given PGconn. */
|
||||
extern int PQregisterEventProc(PGconn *conn, PGEventProc proc,
|
||||
const char *name, void *passThrough);
|
||||
extern int PQregisterEventProc(PGconn *conn, PGEventProc proc,
|
||||
const char *name, void *passThrough);
|
||||
|
||||
/* Sets the PGconn instance data for the provided proc to data. */
|
||||
extern int PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data);
|
||||
@@ -91,4 +91,4 @@ extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBPQ_EVENTS_H */
|
||||
#endif /* LIBPQ_EVENTS_H */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.146 2009/03/31 01:41:27 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.147 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -31,10 +31,10 @@ extern "C"
|
||||
/*
|
||||
* Option flags for PQcopyResult
|
||||
*/
|
||||
#define PG_COPYRES_ATTRS 0x01
|
||||
#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */
|
||||
#define PG_COPYRES_EVENTS 0x04
|
||||
#define PG_COPYRES_NOTICEHOOKS 0x08
|
||||
#define PG_COPYRES_ATTRS 0x01
|
||||
#define PG_COPYRES_TUPLES 0x02 /* Implies PG_COPYRES_ATTRS */
|
||||
#define PG_COPYRES_EVENTS 0x04
|
||||
#define PG_COPYRES_NOTICEHOOKS 0x08
|
||||
|
||||
/* Application-visible enum types */
|
||||
|
||||
@@ -463,9 +463,9 @@ extern void PQfreemem(void *ptr);
|
||||
/* Create and manipulate PGresults */
|
||||
extern PGresult *PQmakeEmptyPGresult(PGconn *conn, ExecStatusType status);
|
||||
extern PGresult *PQcopyResult(const PGresult *src, int flags);
|
||||
extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs);
|
||||
extern int PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs);
|
||||
extern void *PQresultAlloc(PGresult *res, size_t nBytes);
|
||||
extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
|
||||
extern int PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len);
|
||||
|
||||
/* Quoting strings before inclusion in queries. */
|
||||
extern size_t PQescapeStringConn(PGconn *conn,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.141 2009/04/24 09:43:10 mha Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.142 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -69,7 +69,7 @@ typedef struct
|
||||
{
|
||||
void *value;
|
||||
int length;
|
||||
} gss_buffer_desc;
|
||||
} gss_buffer_desc;
|
||||
#endif
|
||||
#endif /* ENABLE_SSPI */
|
||||
|
||||
@@ -155,11 +155,11 @@ typedef struct
|
||||
|
||||
typedef struct PGEvent
|
||||
{
|
||||
PGEventProc proc; /* the function to call on events */
|
||||
PGEventProc proc; /* the function to call on events */
|
||||
char *name; /* used only for error messages */
|
||||
void *passThrough; /* pointer supplied at registration time */
|
||||
void *data; /* optional state (instance) data */
|
||||
bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */
|
||||
bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */
|
||||
} PGEvent;
|
||||
|
||||
struct pg_result
|
||||
@@ -182,7 +182,7 @@ struct pg_result
|
||||
* on the PGresult don't have to reference the PGconn.
|
||||
*/
|
||||
PGNoticeHooks noticeHooks;
|
||||
PGEvent *events;
|
||||
PGEvent *events;
|
||||
int nEvents;
|
||||
int client_encoding; /* encoding id */
|
||||
|
||||
@@ -310,9 +310,9 @@ struct pg_conn
|
||||
PGNoticeHooks noticeHooks;
|
||||
|
||||
/* Event procs registered via PQregisterEventProc */
|
||||
PGEvent *events; /* expandable array of event data */
|
||||
PGEvent *events; /* expandable array of event data */
|
||||
int nEvents; /* number of active events */
|
||||
int eventArraySize; /* allocated array size */
|
||||
int eventArraySize; /* allocated array size */
|
||||
|
||||
/* Status indicators */
|
||||
ConnStatusType status;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.26 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.c,v 1.27 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -47,11 +47,12 @@ markPQExpBufferBroken(PQExpBuffer str)
|
||||
{
|
||||
if (str->data != oom_buffer)
|
||||
free(str->data);
|
||||
|
||||
/*
|
||||
* Casting away const here is a bit ugly, but it seems preferable to
|
||||
* not marking oom_buffer const. We want to do that to encourage the
|
||||
* compiler to put oom_buffer in read-only storage, so that anyone who
|
||||
* tries to scribble on a broken PQExpBuffer will get a failure.
|
||||
* Casting away const here is a bit ugly, but it seems preferable to not
|
||||
* marking oom_buffer const. We want to do that to encourage the compiler
|
||||
* to put oom_buffer in read-only storage, so that anyone who tries to
|
||||
* scribble on a broken PQExpBuffer will get a failure.
|
||||
*/
|
||||
str->data = (char *) oom_buffer;
|
||||
str->len = 0;
|
||||
@@ -126,7 +127,7 @@ termPQExpBuffer(PQExpBuffer str)
|
||||
if (str->data != oom_buffer)
|
||||
free(str->data);
|
||||
/* just for luck, make the buffer validly empty. */
|
||||
str->data = (char *) oom_buffer; /* see comment above */
|
||||
str->data = (char *) oom_buffer; /* see comment above */
|
||||
str->maxlen = 0;
|
||||
str->len = 0;
|
||||
}
|
||||
@@ -160,7 +161,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
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.h,v 1.22 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/pqexpbuffer.h,v 1.23 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -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.
|
||||
*-------------------------
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ typedef PQExpBufferData *PQExpBuffer;
|
||||
* are no-ops.
|
||||
*------------------------
|
||||
*/
|
||||
#define PQExpBufferBroken(str) \
|
||||
#define PQExpBufferBroken(str) \
|
||||
((str) == NULL || (str)->maxlen == 0)
|
||||
|
||||
/*------------------------
|
||||
@@ -126,7 +126,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);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 2004-2009, PostgreSQL Global Development Group
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.18 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/pthread-win32.c,v 1.19 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ pthread_getspecific(pthread_key_t key)
|
||||
int
|
||||
pthread_mutex_init(pthread_mutex_t *mp, void *attr)
|
||||
{
|
||||
*mp = (CRITICAL_SECTION *)malloc(sizeof(CRITICAL_SECTION));
|
||||
*mp = (CRITICAL_SECTION *) malloc(sizeof(CRITICAL_SECTION));
|
||||
if (!*mp)
|
||||
return 1;
|
||||
InitializeCriticalSection(*mp);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/win32.c,v 1.25 2009/01/01 17:24:03 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/win32.c,v 1.26 2009/06/11 14:49:14 momjian Exp $
|
||||
*
|
||||
*
|
||||
* FILE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/win32.h,v 1.29 2008/05/17 01:28:25 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/win32.h,v 1.30 2009/06/11 14:49:14 momjian Exp $
|
||||
*/
|
||||
#ifndef __win32_h_included
|
||||
#define __win32_h_included
|
||||
|
||||
Reference in New Issue
Block a user