1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

pgindent run before PG 9.1 beta 1.

This commit is contained in:
Bruce Momjian
2011-04-10 11:42:00 -04:00
parent 9a8b73147c
commit bf50caf105
446 changed files with 5737 additions and 5258 deletions

View File

@@ -179,7 +179,7 @@ static char *
ecpg_strndup(const char *str, size_t len)
{
size_t real_len = strlen(str);
int use_len = (int) ((real_len > len) ? len : real_len);
int use_len = (int) ((real_len > len) ? len : real_len);
char *new = malloc(use_len + 1);
@@ -983,33 +983,33 @@ ldchar(char *src, int len, char *dest)
int
rgetmsg(int msgnum, char *s, int maxsize)
{
(void) msgnum; /* keep the compiler quiet */
(void) s; /* keep the compiler quiet */
(void) maxsize; /* keep the compiler quiet */
(void) msgnum; /* keep the compiler quiet */
(void) s; /* keep the compiler quiet */
(void) maxsize; /* keep the compiler quiet */
return 0;
}
int
rtypalign(int offset, int type)
{
(void) offset; /* keep the compiler quiet */
(void) type; /* keep the compiler quiet */
(void) offset; /* keep the compiler quiet */
(void) type; /* keep the compiler quiet */
return 0;
}
int
rtypmsize(int type, int len)
{
(void) type; /* keep the compiler quiet */
(void) len; /* keep the compiler quiet */
(void) type; /* keep the compiler quiet */
(void) len; /* keep the compiler quiet */
return 0;
}
int
rtypwidth(int sqltype, int sqllen)
{
(void) sqltype; /* keep the compiler quiet */
(void) sqllen; /* keep the compiler quiet */
(void) sqltype; /* keep the compiler quiet */
(void) sqllen; /* keep the compiler quiet */
return 0;
}

View File

@@ -216,7 +216,7 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
struct sqlca_t *sqlca = ECPGget_sqlca();
int sqlcode;
(void) arg; /* keep the compiler quiet */
(void) arg; /* keep the compiler quiet */
if (sqlstate == NULL)
sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;

View File

@@ -75,7 +75,7 @@ static pthread_once_t auto_mem_once = PTHREAD_ONCE_INIT;
static void
auto_mem_destructor(void *arg)
{
(void) arg; /* keep the compiler quiet */
(void) arg; /* keep the compiler quiet */
ECPGfree_auto_mem();
}

View File

@@ -164,7 +164,7 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, c
struct prepared_statement *this,
*prev;
(void) questionmarks; /* quiet the compiler */
(void) questionmarks; /* quiet the compiler */
con = ecpg_get_connection(connection_name);
if (!ecpg_init(con, connection_name, lineno))
@@ -305,7 +305,7 @@ ecpg_prepared(const char *name, struct connection * con)
char *
ECPGprepared_statement(const char *connection_name, const char *name, int lineno)
{
(void)lineno; /* keep the compiler quiet */
(void) lineno; /* keep the compiler quiet */
return ecpg_prepared(name, ecpg_get_connection(connection_name));
}

View File

@@ -12,7 +12,7 @@
#include "extern.h"
int ret_value = 0;
bool autocommit = false,
bool autocommit = false,
auto_create_c = false,
system_includes = false,
force_indicator = true,
@@ -127,7 +127,7 @@ main(int argc, char *const argv[])
int fnr,
c,
out_option = 0;
bool verbose = false,
bool verbose = false,
header_mode = false;
struct _include_path *ip;
const char *progname;

View File

@@ -18,14 +18,14 @@
/* variables */
extern bool autocommit,
extern bool autocommit,
auto_create_c,
system_includes,
force_indicator,
questionmarks,
regression_mode,
auto_prepare;
extern int braces_open,
extern int braces_open,
ret_value,
struct_level,
ecpg_internal_var;

View File

@@ -246,7 +246,7 @@ pg_krb5_sendauth(PGconn *conn)
}
retval = krb5_sendauth(info.pg_krb5_context, &auth_context,
(krb5_pointer) & conn->sock, (char *) conn->krbsrvname,
(krb5_pointer) &conn->sock, (char *) conn->krbsrvname,
info.pg_krb5_client, server,
AP_OPTS_MUTUAL_REQUIRED,
NULL, 0, /* no creds, use ccache instead */
@@ -892,14 +892,14 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn)
pgunlock_thread();
}
break;
#else /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */
#else /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */
/* No GSSAPI *or* SSPI support */
case AUTH_REQ_GSS:
case AUTH_REQ_GSS_CONT:
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("GSSAPI authentication not supported\n"));
return STATUS_ERROR;
#endif /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */
#endif /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */
#ifdef ENABLE_SSPI
case AUTH_REQ_SSPI:
@@ -919,19 +919,20 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn)
pgunlock_thread();
break;
#else
/*
* No SSPI support. However, if we have GSSAPI but not SSPI
* support, AUTH_REQ_SSPI will have been handled in the codepath
* for AUTH_REQ_GSSAPI above, so don't duplicate the case label
* in that case.
* for AUTH_REQ_GSSAPI above, so don't duplicate the case label in
* that case.
*/
#if !defined(ENABLE_GSS)
case AUTH_REQ_SSPI:
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("SSPI authentication not supported\n"));
return STATUS_ERROR;
#endif /* !define(ENABLE_GSSAPI) */
#endif /* ENABLE_SSPI */
#endif /* !define(ENABLE_GSSAPI) */
#endif /* ENABLE_SSPI */
case AUTH_REQ_CRYPT:

View File

@@ -41,7 +41,7 @@
#endif
#define near
#include <shlobj.h>
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */
#include <mstcpip.h>
#endif
#else
@@ -1011,13 +1011,13 @@ connectFailureMessage(PGconn *conn, int errorno)
else
#endif /* HAVE_UNIX_SOCKETS */
{
char host_addr[NI_MAXHOST];
bool display_host_addr;
char host_addr[NI_MAXHOST];
bool display_host_addr;
struct sockaddr_storage *addr = &conn->raddr.addr;
/*
* Optionally display the network address with the hostname.
* This is useful to distinguish between IPv4 and IPv6 connections.
* Optionally display the network address with the hostname. This is
* useful to distinguish between IPv4 and IPv6 connections.
*/
if (conn->pghostaddr != NULL)
strlcpy(host_addr, conn->pghostaddr, NI_MAXHOST);
@@ -1033,7 +1033,7 @@ connectFailureMessage(PGconn *conn, int errorno)
else if (addr->ss_family == AF_INET6)
{
if (inet_net_ntop(AF_INET6,
&((struct sockaddr_in6 *) addr)->sin6_addr.s6_addr,
&((struct sockaddr_in6 *) addr)->sin6_addr.s6_addr,
128,
host_addr, sizeof(host_addr)) == NULL)
strcpy(host_addr, "???");
@@ -1043,25 +1043,25 @@ connectFailureMessage(PGconn *conn, int errorno)
strcpy(host_addr, "???");
/*
* If the user did not supply an IP address using 'hostaddr', and
* 'host' was missing or does not match our lookup, display the
* looked-up IP address.
* If the user did not supply an IP address using 'hostaddr', and
* 'host' was missing or does not match our lookup, display the
* looked-up IP address.
*/
display_host_addr = (conn->pghostaddr == NULL) &&
((conn->pghost == NULL) ||
(strcmp(conn->pghost, host_addr) != 0));
((conn->pghost == NULL) ||
(strcmp(conn->pghost, host_addr) != 0));
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not connect to server: %s\n"
"\tIs the server running on host \"%s\"%s%s%s and accepting\n"
"\tIs the server running on host \"%s\"%s%s%s and accepting\n"
"\tTCP/IP connections on port %s?\n"),
SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)),
(conn->pghostaddr && conn->pghostaddr[0] != '\0')
? conn->pghostaddr
: (conn->pghost && conn->pghost[0] != '\0')
? conn->pghost
: DefaultHost,
/* display the IP address only if not already output */
? conn->pghost
: DefaultHost,
/* display the IP address only if not already output */
display_host_addr ? " (" : "",
display_host_addr ? host_addr : "",
display_host_addr ? ")" : "",
@@ -1121,10 +1121,10 @@ setKeepalivesIdle(PGconn *conn)
if (setsockopt(conn->sock, IPPROTO_TCP, TCP_KEEPALIVE,
(char *) &idle, sizeof(idle)) < 0)
{
char sebuf[256];
char sebuf[256];
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("setsockopt(TCP_KEEPALIVE) failed: %s\n"),
libpq_gettext("setsockopt(TCP_KEEPALIVE) failed: %s\n"),
SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf)));
return 0;
}
@@ -1196,8 +1196,7 @@ setKeepalivesCount(PGconn *conn)
return 1;
}
#else /* Win32 */
#else /* Win32 */
#ifdef SIO_KEEPALIVE_VALS
/*
* Enable keepalives and set the keepalive values on Win32,
@@ -1206,20 +1205,20 @@ setKeepalivesCount(PGconn *conn)
static int
setKeepalivesWin32(PGconn *conn)
{
struct tcp_keepalive ka;
DWORD retsize;
int idle = 0;
int interval = 0;
struct tcp_keepalive ka;
DWORD retsize;
int idle = 0;
int interval = 0;
if (conn->keepalives_idle)
idle = atoi(conn->keepalives_idle);
if (idle <= 0)
idle = 2 * 60 * 60; /* 2 hours = default */
idle = 2 * 60 * 60; /* 2 hours = default */
if (conn->keepalives_interval)
interval = atoi(conn->keepalives_interval);
if (interval <= 0)
interval = 1; /* 1 second = default */
interval = 1; /* 1 second = default */
ka.onoff = 1;
ka.keepalivetime = idle * 1000;
@@ -1237,14 +1236,14 @@ setKeepalivesWin32(PGconn *conn)
!= 0)
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui\n"),
libpq_gettext("WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui\n"),
WSAGetLastError());
return 0;
}
return 1;
}
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
/* ----------
* connectDBStart -
@@ -1661,12 +1660,12 @@ keep_going: /* We will come back to here until there is
|| !setKeepalivesInterval(conn)
|| !setKeepalivesCount(conn))
err = 1;
#else /* WIN32 */
#else /* WIN32 */
#ifdef SIO_KEEPALIVE_VALS
else if (!setKeepalivesWin32(conn))
err = 1;
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
#endif /* SIO_KEEPALIVE_VALS */
#endif /* WIN32 */
if (err)
{
@@ -1864,8 +1863,8 @@ keep_going: /* We will come back to here until there is
if (getpeereid(conn->sock, &uid, &gid) != 0)
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not get peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
libpq_gettext("could not get peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
goto error_return;
}
#elif defined(SO_PEERCRED)
@@ -1878,20 +1877,20 @@ keep_going: /* We will come back to here until there is
so_len != sizeof(peercred))
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not get peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
libpq_gettext("could not get peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
goto error_return;
}
uid = peercred.uid;
#elif defined(HAVE_GETPEERUCRED)
ucred_t *ucred;
ucred = NULL; /* must be initialized to NULL */
ucred = NULL; /* must be initialized to NULL */
if (getpeerucred(conn->sock, &ucred) == -1)
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not get peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
libpq_gettext("could not get peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
goto error_return;
}
@@ -1899,7 +1898,7 @@ keep_going: /* We will come back to here until there is
{
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not get effective UID from peer credentials: %s\n"),
pqStrerror(errno, sebuf, sizeof(sebuf)));
pqStrerror(errno, sebuf, sizeof(sebuf)));
ucred_free(ucred);
goto error_return;
}
@@ -1925,7 +1924,7 @@ keep_going: /* We will come back to here until there is
conn->requirepeer, pass->pw_name);
goto error_return;
}
#else /* can't support requirepeer */
#else /* can't support requirepeer */
appendPQExpBuffer(&conn->errorMessage,
libpq_gettext("requirepeer parameter is not supported on this platform\n"));
goto error_return;
@@ -2613,18 +2612,18 @@ internal_ping(PGconn *conn)
* failure in sufficient detail to decide what to return. We do not want
* to report that the server is not up just because we didn't have a valid
* password, for example. In fact, any sort of authentication request
* implies the server is up. (We need this check since the libpq side
* of things might have pulled the plug on the connection before getting
* an error as such from the postmaster.)
* implies the server is up. (We need this check since the libpq side of
* things might have pulled the plug on the connection before getting an
* error as such from the postmaster.)
*/
if (conn->auth_req_received)
return PQPING_OK;
/*
* 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.
@@ -2638,8 +2637,8 @@ internal_ping(PGconn *conn)
return PQPING_NO_RESPONSE;
/*
* Report PQPING_REJECT if server says it's not accepting connections.
* (We distinguish this case mainly for the convenience of pg_ctl.)
* Report PQPING_REJECT if server says it's not accepting connections. (We
* distinguish this case mainly for the convenience of pg_ctl.)
*/
if (strcmp(conn->last_sqlstate, ERRCODE_CANNOT_CONNECT_NOW) == 0)
return PQPING_REJECT;

View File

@@ -1787,8 +1787,8 @@ PQexecStart(PGconn *conn)
{
/* We don't allow PQexec during COPY BOTH */
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("PQexec not allowed during COPY BOTH\n"));
return false;
libpq_gettext("PQexec not allowed during COPY BOTH\n"));
return false;
}
/* check for loss of connection, too */
if (conn->status == CONNECTION_BAD)
@@ -1813,8 +1813,8 @@ PQexecFinish(PGconn *conn)
* than one --- but merge error messages if we get more than one error
* result.
*
* We have to stop if we see copy in/out/both, however. We will resume parsing
* after application performs the data transfer.
* We have to stop if we see copy in/out/both, however. We will resume
* parsing after application performs the data transfer.
*
* Also stop if the connection is lost (else we'll loop infinitely).
*/
@@ -3464,11 +3464,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;
}
}

View File

@@ -100,11 +100,11 @@ pqSetenvPoll(PGconn *conn)
{
switch (conn->setenv_state)
{
/*
* The _CLIENT_ENCODING_SEND code is slightly different
* from _OPTION_SEND below (e.g., no getenv() call), which
* is why a different state is used.
*/
/*
* The _CLIENT_ENCODING_SEND code is slightly different from
* _OPTION_SEND below (e.g., no getenv() call), which is why a
* different state is used.
*/
case SETENV_STATE_CLIENT_ENCODING_SEND:
{
char setQuery[100]; /* note length limit in
@@ -601,9 +601,10 @@ pqParseInput2(PGconn *conn)
case 'H': /* Start Copy Out */
conn->asyncStatus = PGASYNC_COPY_OUT;
break;
/*
* Don't need to process CopyBothResponse here because
* it never arrives from the server during protocol 2.0.
* Don't need to process CopyBothResponse here because it
* never arrives from the server during protocol 2.0.
*/
default:
printfPQExpBuffer(&conn->errorMessage,

View File

@@ -1400,8 +1400,8 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
/*
* On end-of-copy, exit COPY_OUT or COPY_BOTH 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.
* Copy Done, but we let parseInput read that. If error, we
* expect the state was already changed.
*/
if (msgLength == -1)
conn->asyncStatus = PGASYNC_BUSY;

View File

@@ -589,8 +589,8 @@ static bool
verify_peer_name_matches_certificate(PGconn *conn)
{
/*
* If told not to verify the peer name, don't do it. Return true indicating
* that the verification was successful.
* If told not to verify the peer name, don't do it. Return true
* indicating that the verification was successful.
*/
if (strcmp(conn->sslmode, "verify-full") != 0)
return true;
@@ -839,7 +839,7 @@ initialize_SSL(PGconn *conn)
!(conn->sslrootcert && strlen(conn->sslrootcert) > 0) ||
!(conn->sslcrl && strlen(conn->sslcrl) > 0))
have_homedir = pqGetHomeDirectory(homedir, sizeof(homedir));
else /* won't need it */
else /* won't need it */
have_homedir = false;
/* Read the client certificate file */
@@ -1135,8 +1135,8 @@ initialize_SSL(PGconn *conn)
"Either provide the file or change sslmode to disable server certificate verification.\n"));
else
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("root certificate file \"%s\" does not exist\n"
"Either provide the file or change sslmode to disable server certificate verification.\n"), fnbuf);
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;
}
}

View File

@@ -414,7 +414,7 @@ extern int PQisnonblocking(const PGconn *conn);
extern int PQisthreadsafe(void);
extern PGPing PQping(const char *conninfo);
extern PGPing PQpingParams(const char **keywords,
const char **values, int expand_dbname);
const char **values, int expand_dbname);
/* Force the write buffer to be written (or at least try) */
extern int PQflush(PGconn *conn);

View File

@@ -295,7 +295,7 @@ struct pg_conn
char *pgtty; /* tty on which the backend messages is
* displayed (OBSOLETE, NOT USED) */
char *connect_timeout; /* connection timeout (numeric string) */
char *client_encoding_initial; /* encoding to use */
char *client_encoding_initial; /* encoding to use */
char *pgoptions; /* options to start the backend with */
char *appname; /* application name */
char *fbappname; /* fallback application name */
@@ -337,7 +337,7 @@ struct pg_conn
PGTransactionStatusType xactStatus; /* never changes to ACTIVE */
PGQueryClass queryclass;
char *last_query; /* last SQL command, or NULL if unknown */
char last_sqlstate[6]; /* last reported SQLSTATE */
char last_sqlstate[6]; /* last reported SQLSTATE */
bool options_valid; /* true if OK to attempt connection */
bool nonblocking; /* whether this connection is using nonblock
* sending semantics */
@@ -353,7 +353,8 @@ struct pg_conn
SockAddr raddr; /* Remote address */
ProtocolVersion pversion; /* FE/BE protocol version in use */
int sversion; /* server version, e.g. 70401 for 7.4.1 */
bool auth_req_received; /* true if any type of auth req received */
bool auth_req_received; /* true if any type of auth req
* received */
bool password_needed; /* true if server demanded a password */
bool dot_pgpass_used; /* true if used .pgpass */
bool sigpipe_so; /* have we masked SIGPIPE via SO_NOSIGPIPE? */