> Looks generally reasonable to me.

Thanks for looking into the patch.

> +/*
> + * initStringInfoInternal
> + *
> + * Initialize a StringInfoData struct (with previously undefined contents)
> + * to describe an empty string.
> + * The initial memory allocation size is specified by 'initsize'.
> + * The valid range for 'initsize' is 1 to MaxAllocSize.
> + */
> +static inline void
> +initStringInfoInternal(StringInfo str, int initsize)
> +{
> +     Assert(initsize > 0);
> +
> +     str->data = (char *) palloc(initsize);
> +     str->maxlen = initsize;
> +     resetStringInfo(str);
> +}
> 
> nitpick: Should we Assert(initsize <= MaxAllocSize) here, too?

Agreed. I have replaced the Assert with this in the attached v4 patch.

        Assert(initsize >= 1 && initsize <= MaxAllocSize);

Note, I changed "initsize > 0" to "initsize >= 1" to better match with
the comment:

>  * The valid range for 'initsize' is 1 to MaxAllocSize.

If there's no objection, I am going to commit the patch.

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

Attachment: v4-0001-Add-new-StringInfo-APIs-to-allow-callers-to-speci.patch
Description: Binary data

Reply via email to