diff options
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 4 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/error.c | 8 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 4 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/misc.c | 8 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.c | 3 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/type.c | 4 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/expected/preproc-outofscope.c | 50 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/expected/preproc-strings.c | 7 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/preproc/strings.h | 7 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/preproc/struct.h | 26 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 47 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-misc.c | 8 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-secure.c | 29 | ||||
-rw-r--r-- | src/interfaces/libpq/libpq-int.h | 8 |
14 files changed, 117 insertions, 96 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index a124a894957..c05dc9014ed 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.55 2010/05/07 19:35:03 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.56 2010/07/06 19:19:00 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -495,7 +495,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p host ? "host=" : "", host ? host : "", port ? "port=" : "", port ? port : "", (user && strlen(user) > 0) ? "user=" : "", user ? user : "", - (passwd && strlen(passwd) > 0) ? "password=" : "", passwd ? passwd : "", + (passwd && strlen(passwd) > 0) ? "password=" : "", passwd ? passwd : "", options ? options : ""); /* diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c index 5451fd29819..a8f3b051ff5 100644 --- a/src/interfaces/ecpg/ecpglib/error.c +++ b/src/interfaces/ecpg/ecpglib/error.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.26 2010/05/08 16:39:52 tgl Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/error.c,v 1.27 2010/07/06 19:19:00 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -308,8 +308,10 @@ ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat) if (strcmp(sqlstate, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR) == 0) { - /* we might get here if the connection breaks down, so let's - * check for this instead of giving just the generic internal error */ + /* + * we might get here if the connection breaks down, so let's check for + * this instead of giving just the generic internal error + */ if (PQstatus(conn) == CONNECTION_BAD) { sqlstate = "57P02"; diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index 868bc699b0b..72eed587461 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.97 2010/05/25 17:28:20 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.98 2010/07/06 19:19:00 momjian Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -708,7 +708,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari strcpy(mallocedval, "array ["); for (element = 0; element < asize; element++) - sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long int*) var->value)[element]); + sprintf(mallocedval + strlen(mallocedval), "%llu,", ((unsigned long long int *) var->value)[element]); strcpy(mallocedval + strlen(mallocedval) - 1, "]"); } diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index 6095c04b627..9a5dca763bd 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.58 2010/05/25 17:28:20 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.59 2010/07/06 19:19:00 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -23,9 +23,9 @@ #define LONG_LONG_MIN LLONG_MIN #else #define LONG_LONG_MIN LONGLONG_MIN -#endif /* LLONG_MIN */ -#endif /* LONG_LONG_MIN */ -#endif /* HAVE_LONG_LONG_INT */ +#endif /* LLONG_MIN */ +#endif /* LONG_LONG_MIN */ +#endif /* HAVE_LONG_LONG_INT */ bool ecpg_internal_regression_mode = false; diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 3247e959829..db52bf5c209 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.115 2010/04/03 19:30:49 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.116 2010/07/06 19:19:00 momjian Exp $ */ /* Main for ecpg, the PostgreSQL embedded SQL precompiler. */ /* Copyright (c) 1996-2010, PostgreSQL Global Development Group */ @@ -469,6 +469,7 @@ main(int argc, char *const argv[]) fclose(yyin); if (out_option == 0 && yyout != stdout) fclose(yyout); + /* * If there was an error, delete the output file. */ diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 32fb144a701..eb7d4aeb9bc 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.92 2010/04/03 07:53:29 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.93 2010/07/06 19:19:00 momjian Exp $ */ #include "postgres_fe.h" @@ -237,7 +237,7 @@ static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, c void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int brace_level, - const char *ind_name, struct ECPGtype * ind_type, const int ind_brace_level, + const char *ind_name, struct ECPGtype * ind_type, const int ind_brace_level, const char *prefix, const char *ind_prefix, char *arr_str_siz, const char *struct_sizeof, const char *ind_struct_sizeof) diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c index d510eb0e03b..e8c4f5c0b46 100644 --- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c +++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c @@ -100,61 +100,63 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *); #line 1 "struct.h" - - - - /* dec_t */ - - + + + + + /* dec_t */ + + typedef struct mytype MYTYPE ; -#line 9 "struct.h" +#line 10 "struct.h" - - - - - - + + + + + + + typedef struct mynulltype MYNULLTYPE ; -#line 18 "struct.h" +#line 20 "struct.h" #line 11 "outofscope.pgc" struct mytype { -#line 3 "struct.h" +#line 4 "struct.h" int id ; -#line 4 "struct.h" +#line 5 "struct.h" char t [ 64 ] ; -#line 5 "struct.h" +#line 6 "struct.h" double d1 ; -#line 6 "struct.h" +#line 7 "struct.h" double d2 ; -#line 7 "struct.h" +#line 8 "struct.h" char c [ 30 ] ; } ; struct mynulltype { -#line 12 "struct.h" +#line 14 "struct.h" int id ; -#line 13 "struct.h" +#line 15 "struct.h" int t ; -#line 14 "struct.h" +#line 16 "struct.h" int d1 ; -#line 15 "struct.h" +#line 17 "struct.h" int d2 ; -#line 16 "struct.h" +#line 18 "struct.h" int c ; } ;/* exec sql end declare section */ #line 12 "outofscope.pgc" diff --git a/src/interfaces/ecpg/test/expected/preproc-strings.c b/src/interfaces/ecpg/test/expected/preproc-strings.c index dd13cf36cf0..310dbb837ea 100644 --- a/src/interfaces/ecpg/test/expected/preproc-strings.c +++ b/src/interfaces/ecpg/test/expected/preproc-strings.c @@ -18,7 +18,12 @@ #line 3 "strings.pgc" /* exec sql begin declare section */ #line 1 "strings.h" - + + + + + + #line 5 "strings.pgc" diff --git a/src/interfaces/ecpg/test/preproc/strings.h b/src/interfaces/ecpg/test/preproc/strings.h index 4779af9881d..07c04f91039 100644 --- a/src/interfaces/ecpg/test/preproc/strings.h +++ b/src/interfaces/ecpg/test/preproc/strings.h @@ -1 +1,6 @@ -char *s1, *s2, *s3, *s4, *s5, *s6; +char *s1, + *s2, + *s3, + *s4, + *s5, + *s6; diff --git a/src/interfaces/ecpg/test/preproc/struct.h b/src/interfaces/ecpg/test/preproc/struct.h index cc4681b74fe..75e802ac6fe 100644 --- a/src/interfaces/ecpg/test/preproc/struct.h +++ b/src/interfaces/ecpg/test/preproc/struct.h @@ -1,18 +1,20 @@ -struct mytype { - int id; - char t[64]; - double d1; /* dec_t */ - double d2; - char c[30]; +struct mytype +{ + int id; + char t[64]; + double d1; /* dec_t */ + double d2; + char c[30]; }; typedef struct mytype MYTYPE; -struct mynulltype { - int id; - int t; - int d1; - int d2; - int c; +struct mynulltype +{ + int id; + int t; + int d1; + int d2; + int c; }; typedef struct mynulltype MYNULLTYPE; diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 795b64e55bf..2c8a0593471 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.394 2010/06/23 21:54:13 rhaas Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.395 2010/07/06 19:19:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -184,16 +184,16 @@ static const PQconninfoOption PQconninfoOptions[] = { "Fallback-Application-Name", "", 64}, {"keepalives", NULL, NULL, NULL, - "TCP-Keepalives", "", 1}, /* should be just '0' or '1' */ + "TCP-Keepalives", "", 1}, /* should be just '0' or '1' */ {"keepalives_idle", NULL, NULL, NULL, - "TCP-Keepalives-Idle", "", 10}, /* strlen(INT32_MAX) == 10 */ + "TCP-Keepalives-Idle", "", 10}, /* strlen(INT32_MAX) == 10 */ {"keepalives_interval", NULL, NULL, NULL, "TCP-Keepalives-Interval", "", 10}, /* strlen(INT32_MAX) == 10 */ {"keepalives_count", NULL, NULL, NULL, - "TCP-Keepalives-Count", "", 10}, /* strlen(INT32_MAX) == 10 */ + "TCP-Keepalives-Count", "", 10}, /* strlen(INT32_MAX) == 10 */ #ifdef USE_SSL @@ -988,7 +988,7 @@ useKeepalives(PGconn *conn) static int setKeepalivesIdle(PGconn *conn) { - int idle; + int idle; if (conn->keepalives_idle == NULL) return 1; @@ -1001,10 +1001,10 @@ setKeepalivesIdle(PGconn *conn) if (setsockopt(conn->sock, IPPROTO_TCP, TCP_KEEPIDLE, (char *) &idle, sizeof(idle)) < 0) { - char sebuf[256]; + char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPIDLE) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPIDLE) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1019,7 +1019,7 @@ setKeepalivesIdle(PGconn *conn) static int setKeepalivesInterval(PGconn *conn) { - int interval; + int interval; if (conn->keepalives_interval == NULL) return 1; @@ -1032,10 +1032,10 @@ setKeepalivesInterval(PGconn *conn) if (setsockopt(conn->sock, IPPROTO_TCP, TCP_KEEPINTVL, (char *) &interval, sizeof(interval)) < 0) { - char sebuf[256]; + char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPINTVL) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPINTVL) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1051,7 +1051,7 @@ setKeepalivesInterval(PGconn *conn) static int setKeepalivesCount(PGconn *conn) { - int count; + int count; if (conn->keepalives_count == NULL) return 1; @@ -1064,10 +1064,10 @@ setKeepalivesCount(PGconn *conn) if (setsockopt(conn->sock, IPPROTO_TCP, TCP_KEEPCNT, (char *) &count, sizeof(count)) < 0) { - char sebuf[256]; + char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPCNT) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPCNT) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1464,9 +1464,9 @@ keep_going: /* We will come back to here until there is if (!IS_AF_UNIX(addr_cur->ai_family)) { - int on = 1; - int usekeepalives = useKeepalives(conn); - int err = 0; + int on = 1; + int usekeepalives = useKeepalives(conn); + int err = 0; if (usekeepalives < 0) { @@ -1484,7 +1484,7 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext("setsockopt(SO_KEEPALIVE) failed: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); err = 1; } else if (!setKeepalivesIdle(conn) @@ -2313,7 +2313,7 @@ keep_going: /* We will come back to here until there is error_return: dot_pg_pass_warning(conn); - + /* * We used to close the socket at this point, but that makes it awkward * for those above us if they wish to remove this socket from their own @@ -4608,7 +4608,8 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username) } -static bool getPgPassFilename(char *pgpassfile) +static bool +getPgPassFilename(char *pgpassfile) { char *passfile_env; @@ -4636,21 +4637,21 @@ dot_pg_pass_warning(PGconn *conn) { /* If it was 'invalid authorization', add .pgpass mention */ if (conn->dot_pgpass_used && conn->password_needed && conn->result && - /* only works with >= 9.0 servers */ + /* only works with >= 9.0 servers */ strcmp(PQresultErrorField(conn->result, PG_DIAG_SQLSTATE), - ERRCODE_INVALID_PASSWORD) == 0) + ERRCODE_INVALID_PASSWORD) == 0) { char pgpassfile[MAXPGPATH]; if (!getPgPassFilename(pgpassfile)) return; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("password retrieved from file \"%s\"\n"), + libpq_gettext("password retrieved from file \"%s\"\n"), pgpassfile); } } - + /* * Obtain user's home directory, return in given buffer * diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index f76168ccd44..0b189453dda 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.143 2010/05/09 02:16:00 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.144 2010/07/06 19:19:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1095,11 +1095,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)) diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index a8acf4e5cb1..9558010a81c 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.134 2010/05/26 21:39:27 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.135 2010/07/06 19:19:01 momjian Exp $ * * NOTES * @@ -810,7 +810,7 @@ destroy_ssl_system(void) * Initialize (potentially) per-connection SSL data, namely the * client certificate, private key, and trusted CA certs. * - * conn->ssl must already be created. It receives the connection's client + * conn->ssl must already be created. It receives the connection's client * certificate and private key. Note however that certificates also get * loaded into the SSL_context object, and are therefore accessible to all * connections in this process. This should be OK as long as there aren't @@ -859,8 +859,8 @@ initialize_SSL(PGconn *conn) { /* * If file is not present, just go on without a client cert; server - * might or might not accept the connection. Any other error, however, - * is grounds for complaint. + * might or might not accept the connection. Any other error, + * however, is grounds for complaint. */ if (errno != ENOENT) { @@ -875,14 +875,15 @@ initialize_SSL(PGconn *conn) { /* * Cert file exists, so load it. Since OpenSSL doesn't provide the - * equivalent of "SSL_use_certificate_chain_file", we actually have - * to load the file twice. The first call loads any extra certs - * after the first one into chain-cert storage associated with the - * SSL_context. The second call loads the first cert (only) into - * the SSL object, where it will be correctly paired with the private - * key we load below. We do it this way so that each connection - * understands which subject cert to present, in case different sslcert - * settings are used for different connections in the same process. + * equivalent of "SSL_use_certificate_chain_file", we actually have to + * load the file twice. The first call loads any extra certs after + * the first one into chain-cert storage associated with the + * SSL_context. The second call loads the first cert (only) into the + * SSL object, where it will be correctly paired with the private key + * we load below. We do it this way so that each connection + * understands which subject cert to present, in case different + * sslcert settings are used for different connections in the same + * process. */ if (SSL_CTX_use_certificate_chain_file(SSL_context, fnbuf) != 1) { @@ -994,7 +995,7 @@ initialize_SSL(PGconn *conn) * file */ } else -#endif /* USE_SSL_ENGINE */ +#endif /* USE_SSL_ENGINE */ { /* PGSSLKEY is not an engine, treat it as a filename */ strncpy(fnbuf, conn->sslkey, sizeof(fnbuf)); @@ -1110,7 +1111,7 @@ initialize_SSL(PGconn *conn) { /* * stat() failed; assume root file doesn't exist. If sslmode is - * verify-ca or verify-full, this is an error. Otherwise, continue + * verify-ca or verify-full, this is an error. Otherwise, continue * without performing any server cert verification. */ if (conn->sslmode[0] == 'v') /* "verify-ca" or "verify-full" */ diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 23b914abbc5..ca3497f8f78 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.151 2010/06/23 21:54:13 rhaas Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.152 2010/07/06 19:19:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -302,8 +302,10 @@ struct pg_conn char *pgpass; char *keepalives; /* use TCP keepalives? */ char *keepalives_idle; /* time between TCP keepalives */ - char *keepalives_interval; /* time between TCP keepalive retransmits */ - char *keepalives_count; /* maximum number of TCP keepalive retransmits */ + char *keepalives_interval; /* time between TCP keepalive + * retransmits */ + char *keepalives_count; /* maximum number of TCP keepalive + * retransmits */ char *sslmode; /* SSL mode (require,prefer,allow,disable) */ char *sslkey; /* client key filename */ char *sslcert; /* client certificate filename */ |