From: Tatsuo Ishii <ishii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add new StringInfo APIs to allow callers to specify the buffer s
Date: Fri, 10 Jan 2025 23:24:42 +0000
Message-ID: <E1tWOMs-000tr1-7T@gemulon.postgresql.org> (raw)
Add new StringInfo APIs to allow callers to specify the buffer size.
Previously StringInfo APIs allocated buffers with fixed initial
allocation size of 1024 bytes. This may be too large and inappropriate
for some callers that can do with smaller memory buffers. To fix this,
introduce new APIs that allow callers to specify initial buffer size.
extern StringInfo makeStringInfoExt(int initsize);
extern void initStringInfoExt(StringInfo str, int initsize);
Existing APIs (makeStringInfo() and initStringInfo()) are changed to
call makeStringInfoExt and initStringInfoExt respectively (via inline
helper functions makeStringInfoInternal and initStringInfoInternal),
with the default buffer size of 1024.
Reviewed-by: Nathan Bossart, David Rowley, Michael Paquier, Gurjeet Singh
Discussion: https://postgr.es/m/20241225.123704.1194662271286702010.ishii%40postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a9dcbb4d5c00b703e727e14055ed70c525a86418
Modified Files
--------------
src/common/stringinfo.c | 71 +++++++++++++++++++++++++++++++++++++-------
src/include/lib/stringinfo.h | 29 +++++++++++++++++-
2 files changed, 89 insertions(+), 11 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: ishii@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add new StringInfo APIs to allow callers to specify the buffer s
In-Reply-To: <E1tWOMs-000tr1-7T@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox