diff options
| author | Robert Haas | 2013-04-11 19:20:24 +0000 |
|---|---|---|
| committer | Robert Haas | 2013-04-11 19:20:24 +0000 |
| commit | ef5409534ea854748a04388905334ae958ae0e66 (patch) | |
| tree | 2804afa2b40c79900c61b18aacb1df13e3aa8178 /src/include | |
| parent | 8cbbdddac18d5aaf9546342291fa9a20de4deee8 (diff) | |
Avoid PG_TRY/PG_CATCH overhead if stringinfo is already large enough.copy_hack
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/lib/stringinfo.h | 7 |
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 */ |
