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

Lines changed: 3 additions & 4 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy