error = true;
}
- if (PQExpBufferBroken(&cmd_output))
+ if (PQExpBufferDataBroken(cmd_output))
{
psql_error("%s: out of memory\n", cmd);
error = true;
PQconninfoOption *connOptions;
initPQExpBuffer(&errorBuf);
- if (PQExpBufferBroken(&errorBuf))
+ if (PQExpBufferDataBroken(errorBuf))
return NULL; /* out of memory already :-( */
connOptions = conninfo_parse("", &errorBuf, true);
termPQExpBuffer(&errorBuf);
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)
#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