diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-10-18 21:44:23 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-10-18 21:44:23 -0400 |
commit | e331c60ea727f998eb1023e8a2c468692d10032e (patch) | |
tree | 0fa376584d4b3e981b467e5a07ef9b7f5df99218 /src | |
parent | aa90e148ca70a235897b1227f1a7cd1c66bc5368 (diff) | |
download | postgresql-e331c60ea727f998eb1023e8a2c468692d10032e.tar.gz postgresql-e331c60ea727f998eb1023e8a2c468692d10032e.zip |
Suppress remaining -Waddress warnings from recent gcc versions.
Still an exercise in satisfying pedants.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/psqlscan.l | 2 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/pqexpbuffer.h | 8 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l index d4a9d94a437..0c855ba2482 100644 --- a/src/bin/psql/psqlscan.l +++ b/src/bin/psql/psqlscan.l @@ -1673,7 +1673,7 @@ evaluate_backtick(void) error = true; } - if (PQExpBufferBroken(&cmd_output)) + if (PQExpBufferDataBroken(cmd_output)) { psql_error("%s: out of memory\n", cmd); error = true; diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 64eeebacfee..ed9dce941e1 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -829,7 +829,7 @@ PQconndefaults(void) PQconninfoOption *connOptions; initPQExpBuffer(&errorBuf); - if (PQExpBufferBroken(&errorBuf)) + if (PQExpBufferDataBroken(errorBuf)) return NULL; /* out of memory already :-( */ connOptions = conninfo_parse("", &errorBuf, true); termPQExpBuffer(&errorBuf); @@ -3967,7 +3967,7 @@ PQconninfoParse(const char *conninfo, char **errmsg) if (errmsg) *errmsg = NULL; /* default */ initPQExpBuffer(&errorBuf); - if (PQExpBufferBroken(&errorBuf)) + if (PQExpBufferDataBroken(errorBuf)) return NULL; /* out of memory already :-( */ connOptions = conninfo_parse(conninfo, &errorBuf, false); if (connOptions == NULL && errmsg) diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqexpbuffer.h index d60fedc762e..59cefbfb948 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -60,6 +60,14 @@ typedef PQExpBufferData *PQExpBuffer; ((str) == NULL || (str)->maxlen == 0) /*------------------------ + * Same, but for use when using a static or local PQExpBufferData struct. + * For that, a null-pointer test is useless and may draw compiler warnings. + *------------------------ + */ +#define PQExpBufferDataBroken(buf) \ + ((buf).maxlen == 0) + +/*------------------------ * Initial size of the data buffer in a PQExpBuffer. * NB: this must be large enough to hold error messages that might * be returned by PQrequestCancel(). |