Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ee2ad1c

Browse files
committed
Inline check for full buffer in appendStringInfoChar.
1 parent e81ad79 commit ee2ad1c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/backend/lib/stringinfo.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: stringinfo.c,v 1.22 1999/09/08 16:31:38 tgl Exp $
11+
* $Id: stringinfo.c,v 1.23 1999/11/01 05:10:32 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -146,10 +146,9 @@ appendStringInfo(StringInfo str, const char *fmt,...)
146146
void
147147
appendStringInfoChar(StringInfo str, char ch)
148148
{
149-
Assert(str != NULL);
150-
151149
/* Make more room if needed */
152-
enlargeStringInfo(str, 1);
150+
if (str->len + 1 >= str->maxlen)
151+
enlargeStringInfo(str, 1);
153152

154153
/* OK, append the character */
155154
str->data[str->len] = ch;

0 commit comments

Comments
 (0)