code cleanup empty string initializations

Started by Peter Eisentrautover 8 years ago3 messageshackers
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:

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