Re: remove unnecessary explicit type conversion (to char) for appendStringInfoChar function calls - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: remove unnecessary explicit type conversion (to char) for appendStringInfoChar function calls
Date
Msg-id 8770ae0a-0ee7-450d-83b1-c610cfa2b1ec@dunslane.net
Whole thread Raw
In response to remove unnecessary explicit type conversion (to char) for appendStringInfoChar function calls  (Mahendra Singh Thalor <mahi6run@gmail.com>)
Responses Re: remove unnecessary explicit type conversion (to char) for appendStringInfoChar function calls
Re: remove unnecessary explicit type conversion (to char) for appendStringInfoChar function calls
List pgsql-hackers
On 2025-04-11 Fr 1:36 PM, Mahendra Singh Thalor wrote:
> Hi,
> In the current master code, 3 places we are using appendStringInfoChar
> call with explicit type conversion into char. This is not needed as
> all other places, we are using direct character to append.
>
> --- a/src/backend/tcop/postgres.c
> +++ b/src/backend/tcop/postgres.c
> @@ -302,7 +302,7 @@ InteractiveBackend(StringInfo inBuf)
>           */
>
>          /* Add '\0' to make it look the same as message case. */
> -       appendStringInfoChar(inBuf, (char) '\0');
> +       appendStringInfoChar(inBuf, '\0');
>
> Here, I am attaching a small patch to fix these 3 type conversions on head.
>


Seems odd that this one is necessary at all. Doesn't a StringInfo always 
have a trailing null byte?


cheers


andrew



--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Wolfgang Walther
Date:
Subject: Buildfarm: Enabling injection points on basilisk/dogfish (Alpine / musl)
Next
From: Corey Huinker
Date:
Subject: Re: Can we use Statistics Import and Export feature to perforamance testing?