From ee2ad1cf2e7ed4bb9760d2c7440152d83a5bb9dd Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Mon, 1 Nov 1999 05:10:32 +0000 Subject: [PATCH] Inline check for full buffer in appendStringInfoChar. --- src/backend/lib/stringinfo.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/lib/stringinfo.c b/src/backend/lib/stringinfo.c index 94cb8040604..63852b4cd6b 100644 --- a/src/backend/lib/stringinfo.c +++ b/src/backend/lib/stringinfo.c @@ -8,7 +8,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: stringinfo.c,v 1.22 1999/09/08 16:31:38 tgl Exp $ + * $Id: stringinfo.c,v 1.23 1999/11/01 05:10:32 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -146,10 +146,9 @@ appendStringInfo(StringInfo str, const char *fmt,...) void appendStringInfoChar(StringInfo str, char ch) { - Assert(str != NULL); - /* Make more room if needed */ - enlargeStringInfo(str, 1); + if (str->len + 1 >= str->maxlen) + enlargeStringInfo(str, 1); /* OK, append the character */ str->data[str->len] = ch; -- GitLab