]> granicus.if.org Git - postgresql/commitdiff
Suppress remaining -Waddress warnings from recent gcc versions.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 19 Oct 2011 01:44:23 +0000 (21:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 19 Oct 2011 01:44:23 +0000 (21:44 -0400)
Still an exercise in satisfying pedants.

src/bin/psql/psqlscan.l
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/pqexpbuffer.h

index d4a9d94a4374df76313a8a539ddd7d8fd4383a56..0c855ba2482e494959b2d20da941b2af2ae300e5 100644 (file)
@@ -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;
index 64eeebacfee80506d64513f2000de3a8b050e1ae..ed9dce941e1d57cce51f2c21bf29769dfe2ee542 100644 (file)
@@ -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)
index d60fedc762e57eb454005677f992d50259aebe5d..59cefbfb948a60e49a971db1bb57b9dc871dfc58 100644 (file)
@@ -59,6 +59,14 @@ typedef PQExpBufferData *PQExpBuffer;
 #define PQExpBufferBroken(str) \
        ((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