Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Alexander Korotkov <akorotkov(at)postgresql(dot)org>, pgsql-committers <pgsql-committers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex
Date: 2019-03-17 12:09:07
Message-ID: CAPpHfdtmREDU2eAT4gMDjJRJtFEvMU=tOOzWeeCAPMwofEDXJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Sun, Mar 17, 2019 at 3:00 PM Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 2019-03-17 10:59, Alexander Korotkov wrote:
> > Beautify initialization of JsonValueList and JsonLikeRegexContext
> >
> > Instead of tricky assignment to {0} introduce special macros, which
> > explicitly initialize every field.
>
> To me, this patch is exactly the opposite of what I'd do to "beautify
> initialization". It doesn't seem sustainable to me to create a special
> macro for every structure in the code, not does it improve readability.
> It is much clearer that {0} is uniformly the starting state.

I got two reasons in the mind while committing that:
1) We would probably like to make some values of empty state non-zero in future.
2) In general, it's better to not assume that NULL is binary zero.
However, we assume that a lot in other places. So, it probably
doesn't matter.

Anyway, I thought about this as about just beautification. If it's
bad idea, let's revert this.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-03-18 00:13:06 pgsql: Error out in pg_checksums on incompatible block size
Previous Message Peter Eisentraut 2019-03-17 11:59:49 Re: pgsql: Beautify initialization of JsonValueList and JsonLikeRegexContex