Skip to content

Commit e331c60

Browse files
committed
Suppress remaining -Waddress warnings from recent gcc versions.
Still an exercise in satisfying pedants.
1 parent aa90e14 commit e331c60

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/bin/psql/psqlscan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ evaluate_backtick(void)
16731673
error = true;
16741674
}
16751675
1676-
if (PQExpBufferBroken(&cmd_output))
1676+
if (PQExpBufferDataBroken(cmd_output))
16771677
{
16781678
psql_error("%s: out of memory\n", cmd);
16791679
error = true;

src/interfaces/libpq/fe-connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ PQconndefaults(void)
829829
PQconninfoOption *connOptions;
830830

831831
initPQExpBuffer(&errorBuf);
832-
if (PQExpBufferBroken(&errorBuf))
832+
if (PQExpBufferDataBroken(errorBuf))
833833
return NULL; /* out of memory already :-( */
834834
connOptions = conninfo_parse("", &errorBuf, true);
835835
termPQExpBuffer(&errorBuf);
@@ -3967,7 +3967,7 @@ PQconninfoParse(const char *conninfo, char **errmsg)
39673967
if (errmsg)
39683968
*errmsg = NULL; /* default */
39693969
initPQExpBuffer(&errorBuf);
3970-
if (PQExpBufferBroken(&errorBuf))
3970+
if (PQExpBufferDataBroken(errorBuf))
39713971
return NULL; /* out of memory already :-( */
39723972
connOptions = conninfo_parse(conninfo, &errorBuf, false);
39733973
if (connOptions == NULL && errmsg)

src/interfaces/libpq/pqexpbuffer.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ typedef PQExpBufferData *PQExpBuffer;
5959
#define PQExpBufferBroken(str) \
6060
((str) == NULL || (str)->maxlen == 0)
6161

62+
/*------------------------
63+
* Same, but for use when using a static or local PQExpBufferData struct.
64+
* For that, a null-pointer test is useless and may draw compiler warnings.
65+
*------------------------
66+
*/
67+
#define PQExpBufferDataBroken(buf) \
68+
((buf).maxlen == 0)
69+
6270
/*------------------------
6371
* Initial size of the data buffer in a PQExpBuffer.
6472
* NB: this must be large enough to hold error messages that might

0 commit comments

Comments
 (0)