diff options
author | Bruce Momjian <bruce@momjian.us> | 2015-05-23 21:35:49 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2015-05-23 21:35:49 -0400 |
commit | 807b9e0dff663c5da875af7907a5106c0ff90673 (patch) | |
tree | 89a0cfbd3c9801dcb04aae4ccf2fee935092f958 /src/interfaces | |
parent | 225892552bd3052982d2b97b749e5945ea71facc (diff) | |
download | postgresql-807b9e0dff663c5da875af7907a5106c0ff90673.tar.gz |
pgindent run for 9.5
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/data.c | 3 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 14 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/memory.c | 2 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/parse.pl | 21 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 11 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 14 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure-openssl.c | 86 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 18 |
8 files changed, 88 insertions, 81 deletions
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index 2dcb9153da..c3cd94682d 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -291,7 +291,8 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, date ddres; timestamp tres; interval *ires; - char *endptr, endchar; + char *endptr, + endchar; case ECPGt_short: case ECPGt_int: diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 22ce55b60a..bcb38d25f8 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -499,9 +499,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari char *newcopy = NULL; /* - * arrays are not possible unless the column is an array, too - * FIXME: we do not know if the column is an array here - * array input to singleton column will result in a runtime error + * arrays are not possible unless the column is an array, too FIXME: we do + * not know if the column is an array here array input to singleton column + * will result in a runtime error */ /* @@ -852,7 +852,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari mallocedval = ecpg_strdup("", lineno); if (!mallocedval) - return false; + return false; for (element = 0; element < asize; element++) { @@ -915,7 +915,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari mallocedval = ecpg_strdup("", lineno); if (!mallocedval) - return false; + return false; for (element = 0; element < asize; element++) { @@ -962,7 +962,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari mallocedval = ecpg_strdup("", lineno); if (!mallocedval) - return false; + return false; for (element = 0; element < asize; element++) { @@ -1009,7 +1009,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari mallocedval = ecpg_strdup("", lineno); if (!mallocedval) - return false; + return false; for (element = 0; element < asize; element++) { diff --git a/src/interfaces/ecpg/ecpglib/memory.c b/src/interfaces/ecpg/ecpglib/memory.c index dffc3a7618..9c1d20efc5 100644 --- a/src/interfaces/ecpg/ecpglib/memory.c +++ b/src/interfaces/ecpg/ecpglib/memory.c @@ -107,7 +107,7 @@ static struct auto_mem *auto_allocs = NULL; char * ecpg_auto_alloc(long size, int lineno) { - void *ptr = (void *) ecpg_alloc(size, lineno); + void *ptr = (void *) ecpg_alloc(size, lineno); if (!ptr) return NULL; diff --git a/src/interfaces/ecpg/preproc/parse.pl b/src/interfaces/ecpg/preproc/parse.pl index 588bb63e53..74557425a9 100644 --- a/src/interfaces/ecpg/preproc/parse.pl +++ b/src/interfaces/ecpg/preproc/parse.pl @@ -42,17 +42,16 @@ my %replace_token = ( # or in the block my %replace_string = ( - 'NOT_LA' => 'not', - 'NULLS_LA' => 'nulls', - 'WITH_LA' => 'with', - 'TYPECAST' => '::', - 'DOT_DOT' => '..', - 'COLON_EQUALS' => ':=', - 'EQUALS_GREATER' => '=>', - 'LESS_EQUALS' => '<=', - 'GREATER_EQUALS' => '>=', - 'NOT_EQUALS' => '<>', -); + 'NOT_LA' => 'not', + 'NULLS_LA' => 'nulls', + 'WITH_LA' => 'with', + 'TYPECAST' => '::', + 'DOT_DOT' => '..', + 'COLON_EQUALS' => ':=', + 'EQUALS_GREATER' => '=>', + 'LESS_EQUALS' => '<=', + 'GREATER_EQUALS' => '>=', + 'NOT_EQUALS' => '<>',); # specific replace_types for specific non-terminals - never include the ':' # ECPG-only replace_types are defined in ecpg-replace_types diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index e7c7a256e6..a45f4cba34 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -2011,7 +2011,7 @@ keep_going: /* We will come back to here until there is appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not look up local user ID %d: %s\n"), (int) uid, - pqStrerror(passerr, sebuf, sizeof(sebuf))); + pqStrerror(passerr, sebuf, sizeof(sebuf))); else appendPQExpBuffer(&conn->errorMessage, libpq_gettext("local user with ID %d does not exist\n"), @@ -3845,7 +3845,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (!options[i].val) { printfPQExpBuffer(errorMessage, - libpq_gettext("out of memory\n")); + libpq_gettext("out of memory\n")); free(result); return 3; } @@ -4085,7 +4085,7 @@ parseServiceFile(const char *serviceFile, if (!options[i].val) { printfPQExpBuffer(errorMessage, - libpq_gettext("out of memory\n")); + libpq_gettext("out of memory\n")); fclose(f); return 3; } @@ -4516,7 +4516,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values, if (!options[k].val) { printfPQExpBuffer(errorMessage, - libpq_gettext("out of memory\n")); + libpq_gettext("out of memory\n")); PQconninfoFree(options); PQconninfoFree(dbname_options); return NULL; @@ -4526,6 +4526,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values, } } } + /* * Forget the parsed connection string, so that any subsequent * dbname parameters will not be expanded. @@ -5018,7 +5019,7 @@ conninfo_uri_parse_params(char *params, /* Insert generic message if conninfo_storeval didn't give one. */ if (errorMessage->len == 0) printfPQExpBuffer(errorMessage, - libpq_gettext("invalid URI query parameter: \"%s\"\n"), + libpq_gettext("invalid URI query parameter: \"%s\"\n"), keyword); /* And fail. */ if (malloced) diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 25aecc2f14..0dbcf73222 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -744,10 +744,10 @@ retry3: * 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, but the - * second SSL_read() could still say WANT_READ because the data received - * was not a complete SSL record. So we must play dumb and assume there - * is more data, relying on the SSL layer to detect true EOF. + * data could arrive before we make the pqReadReady() test, but the second + * SSL_read() could still say WANT_READ because the data received was not + * a complete SSL record. So we must play dumb and assume there is more + * data, relying on the SSL layer to detect true EOF. */ #ifdef USE_SSL @@ -916,9 +916,9 @@ pqSendSome(PGconn *conn, int len) * might not arrive until after we've gone to sleep. Therefore, * we wait for either read ready or write ready. * - * In non-blocking mode, we don't wait here directly, but return - * 1 to indicate that data is still pending. The caller should - * wait for both read and write ready conditions, and call + * In non-blocking mode, we don't wait here directly, but return 1 + * to indicate that data is still pending. The caller should wait + * for both read and write ready conditions, and call * PQconsumeInput() on read ready, but just in case it doesn't, we * call pqReadData() ourselves before returning. That's not * enough if the data has not arrived yet, but it's the best we diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c index 0cc5e8d33d..d4069b9e0b 100644 --- a/src/interfaces/libpq/fe-secure-openssl.c +++ b/src/interfaces/libpq/fe-secure-openssl.c @@ -64,19 +64,19 @@ static bool verify_peer_name_matches_certificate(PGconn *); static int verify_cb(int ok, X509_STORE_CTX *ctx); -static int verify_peer_name_matches_certificate_name(PGconn *conn, - ASN1_STRING *name, - char **store_name); +static int verify_peer_name_matches_certificate_name(PGconn *conn, + ASN1_STRING *name, + char **store_name); static void destroy_ssl_system(void); static int initialize_SSL(PGconn *conn); static PostgresPollingStatusType open_client_SSL(PGconn *); static char *SSLerrmessage(void); static void SSLerrfree(char *buf); -static int my_sock_read(BIO *h, char *buf, int size); -static int my_sock_write(BIO *h, const char *buf, int size); +static int my_sock_read(BIO *h, char *buf, int size); +static int my_sock_write(BIO *h, const char *buf, int size); static BIO_METHOD *my_BIO_s_socket(void); -static int my_SSL_set_fd(PGconn *conn, int fd); +static int my_SSL_set_fd(PGconn *conn, int fd); static bool pq_init_ssl_lib = true; @@ -187,7 +187,7 @@ pgtls_open_client(PGconn *conn) } /* - * Is there unread data waiting in the SSL read buffer? + * Is there unread data waiting in the SSL read buffer? */ bool pgtls_read_pending(PGconn *conn) @@ -221,7 +221,7 @@ rloop: { /* Not supposed to happen, so we don't translate the msg */ printfPQExpBuffer(&conn->errorMessage, - "SSL_read failed but did not provide error information\n"); + "SSL_read failed but did not provide error information\n"); /* assume the connection is broken */ result_errno = ECONNRESET; } @@ -247,7 +247,7 @@ rloop: printfPQExpBuffer(&conn->errorMessage, libpq_gettext( "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.\n")); else printfPQExpBuffer(&conn->errorMessage, @@ -279,12 +279,12 @@ rloop: case SSL_ERROR_ZERO_RETURN: /* - * Per OpenSSL documentation, this error code is only returned - * for a clean connection closure, so we should not report it - * as a server crash. + * Per OpenSSL documentation, this error code is only returned for + * a clean connection closure, so we should not report it as a + * server crash. */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL connection has been closed unexpectedly\n")); + libpq_gettext("SSL connection has been closed unexpectedly\n")); result_errno = ECONNRESET; n = -1; break; @@ -329,7 +329,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) { /* Not supposed to happen, so we don't translate the msg */ printfPQExpBuffer(&conn->errorMessage, - "SSL_write failed but did not provide error information\n"); + "SSL_write failed but did not provide error information\n"); /* assume the connection is broken */ result_errno = ECONNRESET; } @@ -337,9 +337,8 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) case SSL_ERROR_WANT_READ: /* - * Returning 0 here causes caller to wait for write-ready, - * which is not really the right thing, but it's the best we - * can do. + * Returning 0 here causes caller to wait for write-ready, which + * is not really the right thing, but it's the best we can do. */ n = 0; break; @@ -354,7 +353,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) printfPQExpBuffer(&conn->errorMessage, libpq_gettext( "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.\n")); else printfPQExpBuffer(&conn->errorMessage, @@ -386,12 +385,12 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) case SSL_ERROR_ZERO_RETURN: /* - * Per OpenSSL documentation, this error code is only returned - * for a clean connection closure, so we should not report it - * as a server crash. + * Per OpenSSL documentation, this error code is only returned for + * a clean connection closure, so we should not report it as a + * server crash. */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL connection has been closed unexpectedly\n")); + libpq_gettext("SSL connection has been closed unexpectedly\n")); result_errno = ECONNRESET; n = -1; break; @@ -509,7 +508,7 @@ verify_peer_name_matches_certificate_name(PGconn *conn, ASN1_STRING *name_entry, if (name_entry == NULL) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL certificate's name entry is missing\n")); + libpq_gettext("SSL certificate's name entry is missing\n")); return -1; } @@ -539,7 +538,7 @@ verify_peer_name_matches_certificate_name(PGconn *conn, ASN1_STRING *name_entry, { free(name); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL certificate's name contains embedded null\n")); + libpq_gettext("SSL certificate's name contains embedded null\n")); return -1; } @@ -574,8 +573,9 @@ verify_peer_name_matches_certificate(PGconn *conn) bool found_match = false; bool got_error = false; char *first_name = NULL; + STACK_OF(GENERAL_NAME) *peer_san; - int i; + int i; int rc; /* @@ -614,7 +614,7 @@ verify_peer_name_matches_certificate(PGconn *conn) names_examined++; rc = verify_peer_name_matches_certificate_name(conn, - name->d.dNSName, + name->d.dNSName, &alt_name); if (rc == -1) got_error = true; @@ -634,6 +634,7 @@ verify_peer_name_matches_certificate(PGconn *conn) } sk_GENERAL_NAME_free(peer_san); } + /* * If there is no subjectAltName extension of type dNSName, check the * Common Name. @@ -656,10 +657,10 @@ verify_peer_name_matches_certificate(PGconn *conn) { names_examined++; rc = verify_peer_name_matches_certificate_name( - conn, - X509_NAME_ENTRY_get_data( - X509_NAME_get_entry(subject_name, cn_index)), - &first_name); + conn, + X509_NAME_ENTRY_get_data( + X509_NAME_get_entry(subject_name, cn_index)), + &first_name); if (rc == -1) got_error = true; @@ -672,10 +673,10 @@ verify_peer_name_matches_certificate(PGconn *conn) if (!found_match && !got_error) { /* - * No match. Include the name from the server certificate in the - * error message, to aid debugging broken configurations. If there - * are multiple names, only print the first one to avoid an overly - * long error message. + * No match. Include the name from the server certificate in the error + * message, to aid debugging broken configurations. If there are + * multiple names, only print the first one to avoid an overly long + * error message. */ if (names_examined > 1) { @@ -806,8 +807,10 @@ pgtls_init(PGconn *conn) if (ssl_open_connections++ == 0) { - /* These are only required for threaded libcrypto applications, but - * make sure we don't stomp on them if they're already set. */ + /* + * These are only required for threaded libcrypto applications, + * but make sure we don't stomp on them if they're already set. + */ if (CRYPTO_get_id_callback() == NULL) CRYPTO_set_id_callback(pq_threadidcallback); if (CRYPTO_get_locking_callback() == NULL) @@ -888,8 +891,10 @@ destroy_ssl_system(void) if (pq_init_crypto_lib && ssl_open_connections == 0) { - /* No connections left, unregister libcrypto callbacks, if no one - * registered different ones in the meantime. */ + /* + * No connections left, unregister libcrypto callbacks, if no one + * registered different ones in the meantime. + */ if (CRYPTO_get_locking_callback() == pq_lockingcallback) CRYPTO_set_locking_callback(NULL); if (CRYPTO_get_id_callback() == pq_threadidcallback) @@ -1538,6 +1543,7 @@ PQsslAttributes(PGconn *conn) "protocol", NULL }; + return result; } @@ -1555,7 +1561,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name) if (strcmp(attribute_name, "key_bits") == 0) { static char sslbits_str[10]; - int sslbits; + int sslbits; SSL_get_cipher_bits(conn->ssl, &sslbits); snprintf(sslbits_str, sizeof(sslbits_str), "%d", sslbits); @@ -1571,7 +1577,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name) if (strcmp(attribute_name, "protocol") == 0) return SSL_get_version(conn->ssl); - return NULL; /* unknown attribute */ + return NULL; /* unknown attribute */ } /* diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 57c572bd09..db91e52ee9 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -251,14 +251,14 @@ pqsecure_raw_read(PGconn *conn, void *ptr, size_t len) printfPQExpBuffer(&conn->errorMessage, libpq_gettext( "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.\n")); break; #endif default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not receive data from server: %s\n"), + libpq_gettext("could not receive data from server: %s\n"), SOCK_STRERROR(result_errno, sebuf, sizeof(sebuf))); break; @@ -323,9 +323,9 @@ retry_masked: result_errno = SOCK_ERRNO; /* - * If we see an EINVAL, it may be because MSG_NOSIGNAL isn't - * available on this machine. So, clear sigpipe_flag so we don't - * try the flag again, and retry the send(). + * If we see an EINVAL, it may be because MSG_NOSIGNAL isn't available + * on this machine. So, clear sigpipe_flag so we don't try the flag + * again, and retry the send(). */ #ifdef MSG_NOSIGNAL if (flags != 0 && result_errno == EINVAL) @@ -360,15 +360,15 @@ retry_masked: printfPQExpBuffer(&conn->errorMessage, libpq_gettext( "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.\n")); break; default: printfPQExpBuffer(&conn->errorMessage, libpq_gettext("could not send data to server: %s\n"), - SOCK_STRERROR(result_errno, - sebuf, sizeof(sebuf))); + SOCK_STRERROR(result_errno, + sebuf, sizeof(sebuf))); break; } } @@ -411,7 +411,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name) const char ** PQsslAttributes(PGconn *conn) { - static const char *result[] = { NULL }; + static const char *result[] = {NULL}; return result; } |