summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/lib/stringinfo.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/lib/stringinfo.h b/src/include/lib/stringinfo.h
index ecb693fcc2..f795680777 100644
--- a/src/include/lib/stringinfo.h
+++ b/src/include/lib/stringinfo.h
@@ -153,4 +153,11 @@ extern void appendBinaryStringInfo(StringInfo str,
*/
extern void enlargeStringInfo(StringInfo str, int needed);
+/*------------------------
+ * isStringInfoLargeEnough
+ * Test whether a StringInfo's buffer can hold at least 'needed' more bytes.
+ */
+#define isStringInfoLargeEnough(str,needed) \
+ ((needed) < (str)->maxlen - ((str)->len + 1))
+
#endif /* STRINGINFO_H */