Re: pgsql: Use FLEXIBLE_ARRAY_MEMBER in a bunch more places.

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, pgsql-committers(at)postgresql(dot)org, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: pgsql: Use FLEXIBLE_ARRAY_MEMBER in a bunch more places.
Date: 2015-02-21 01:16:16
Message-ID: 20150221011616.GS2500@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tom Lane wrote:

> A relevant technique that's been used in a lot of our code is to define
> an intermediate macro, along the lines of
>
> #define SizeofHeapTupleHeader offsetof(HeapTupleHeaderData, t_bits)
>
> or maybe it would better be called HeapTupleHeaderFixedSize or
> HeapTupleHeaderOverhead. Not sure what reads most nicely.

Maybe the macro could take an argument which is the size of the data
part, so that it could be allocated together with the Overhead part; the
addition would be done in the macro rather than its caller.

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-02-21 06:46:51 pgsql: Some more FLEXIBLE_ARRAY_MEMBER fixes.
Previous Message Tom Lane 2015-02-20 22:59:24 Re: pgsql: Use FLEXIBLE_ARRAY_MEMBER in a bunch more places.