Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1] - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]
Date
Msg-id CAB7nPqTkYdVcgFEXwwPhX3atddqe5BRLp62Fwp=krHz5+_GDCQ@mail.gmail.com
Whole thread Raw
In response to Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]
List pgsql-hackers
On Fri, Feb 20, 2015 at 2:21 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Fri, Feb 20, 2015 at 2:14 PM, Tom Lane wrote:
>> Michael Paquier writes:
>>> Thanks for the clarifications and the review. Attached is a new set.
>>
>> I've reviewed and pushed the 0001 patch (you missed a few things :-().
>
> My apologies. I completely forgot to check for any calls of offsetof
> with the structures changed...

Attached are 3 more patches to improve the coverage (being careful
this time with calls of offsetof and sizeof...):
- 0001 covers varlena in c.h
- 0002 covers HeapTupleHeaderData and MinimalTupleData, with things
changed in code paths of reorderbuffer and decoder
- 0003 changes RecordIOData, used in hstore, rowtypes and json functions

Even with this set applied, the following things remain in backend code:
$ git grep "VARIABLE LENGTH" | grep "[1]"
access/nbtree/nbtutils.c:    BTOneVacInfo vacuums[1];    /* VARIABLE
LENGTH ARRAY */
access/transam/multixact.c:    MultiXactId perBackendXactIds[1];    /*
VARIABLE LENGTH ARRAY */
access/transam/twophase.c:    GlobalTransaction prepXacts[1];
/* VARIABLE LENGTH ARRAY */
commands/tablespace.c:    Oid            tblSpcs[1];        /*
VARIABLE LENGTH ARRAY */
commands/trigger.c:    SetConstraintTriggerData trigstates[1];
/* VARIABLE LENGTH ARRAY */
executor/nodeAgg.c:    AggStatePerGroupData pergroup[1];    /*
VARIABLE LENGTH ARRAY */
optimizer/plan/setrefs.c:    tlist_vinfo vars[1];        /* VARIABLE
LENGTH ARRAY */
postmaster/checkpointer.c:    CheckpointerRequest requests[1];    /*
VARIABLE LENGTH ARRAY */
storage/ipc/pmsignal.c:    sig_atomic_t PMChildFlags[1];        /*
VARIABLE LENGTH ARRAY */
storage/ipc/procarray.c:    int            pgprocnos[1];    /*
VARIABLE LENGTH ARRAY */
utils/adt/rowtypes.c:    ColumnCompareData columns[1];        /*
VARIABLE LENGTH ARRAY */
utils/cache/inval.c:    SharedInvalidationMessage msgs[1];    /*
VARIABLE LENGTH ARRAY */
utils/cache/typcache.c:    EnumItem    enum_values[1]; /* VARIABLE
LENGTH ARRAY */

Regards,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: POLA violation with \c service=
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: pg_basebackup may fail to send feedbacks.