code cleanup empty string initializations

Started by Peter Eisentrautabout 9 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t37327
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 10:25 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t37327_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t37327_1 && git checkout t37327_1

Patchset v1 (message #1) is on t37327_1

Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

In initdb, many global string variables are initialized as empty strings
("") and then checked later with strcmp(), instead of just using NULL.
I think this is probably left over from the shell script conversion.
The style has also spread to pg_basebackup. So here is a patch to clean
that up, and a second patch to clean up some other a bit confusing
business in initdb that seems like old shell script code.

While looking around, I found some useless empty string initializations
in the ecpg test suite as well, and here is another patch for that.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

t37327_1
0001-Remove-useless-dead-code.patchtext/plain; charset=UTF-8; name=0001-Remove-useless-dead-code.patch; x-mac-creator=0; x-mac-type=0Download+22-23
0002-Remove-useless-empty-string-initializations.patchtext/plain; charset=UTF-8; name=0002-Remove-useless-empty-string-initializations.patch; x-mac-creator=0; x-mac-type=0Download+39-38
0003-Clean-up-excessive-code.patchtext/plain; charset=UTF-8; name=0003-Clean-up-excessive-code.patch; x-mac-creator=0; x-mac-type=0Download+11-16
#2Aleksandr Parfenov
a.parfenov@postgrespro.ru
In reply to: Peter Eisentraut (#1)
Re: code cleanup empty string initializations

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: tested, passed

Hi Peter,

I looked through your patches and its look good to me.
Patches make code more readable and clear, especially in case of encodingid.

The new status of this patch is: Ready for Committer

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Aleksandr Parfenov (#2)
Re: code cleanup empty string initializations

On 9/8/17 03:45, Aleksandr Parfenov wrote:

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: tested, passed

Hi Peter,

I looked through your patches and its look good to me.
Patches make code more readable and clear, especially in case of encodingid.

The new status of this patch is: Ready for Committer

Committed. Thanks!

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers