Re: Proposal: add new API to stringinfo

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Cc: michael(at)paquier(dot)xyz, dgrowleyml(at)gmail(dot)com, andrew(at)dunslane(dot)net, gurjeet(at)singh(dot)im
Subject: Re: Proposal: add new API to stringinfo
Date: 2025-01-04 04:54:39
Message-ID: 20250104.135439.2265480069984935562.ishii@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> With opinions from Michael and David , what about following additional
>> APIs?
>>
>> #define STRINGINFO_DEFAULT_SIZE 1024 /* default initial allocation size
>> #*/
>> #define STRINGINFO_SMALL_SIZE 64 /* small initial allocation size */
>>
>> #define makeStringInfo makeStringInfoExtended(STRINGINFO_DEFAULT_SIZE)
>> #define initStringInfo(str) initStringInfoExtended(str,
>> #STRINGINFO_DEFAULT_SIZE)
>>
>> extern StringInfo makeStringInfoExtended(int initsize);
>> extern void initStringInfoExtended(StringInfo str, int initsize);
>>
>
>
> Seems like a good idea.

Thanks.

> Minor nit: the definition of the macro should contain parentheses, like so:
> #define makeStringInfo() ....

Indeed. Thanks for pointing it out.

Attached is the patch for this.

Best reagards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp

Attachment Content-Type Size
v1-0001-Add-new-StringInfo-APIs.patch text/x-patch 4.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2025-01-04 05:24:33 Re: Sort functions with specialized comparators
Previous Message Michael Harris 2025-01-04 04:34:37 Re: FileFallocate misbehaving on XFS