Re: remove unnecessary explicit type conversion (to char) for appendStringInfoChar function calls
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Mahendra Singh Thalor <mahi6run@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-12T18:26:29Z
Lists: 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