Re: turn fastgetattr and heap_getattr to inline functions

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Japin Li <japinli(at)hotmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: turn fastgetattr and heap_getattr to inline functions
Date: 2022-03-24 16:44:38
Message-ID: 81552967-c388-711a-6f6b-fba631690440@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24.03.22 15:32, Alvaro Herrera wrote:
>> +static inline Datum
>> +heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
>> +{
>> + if (attnum > 0)
>> + {
>> + if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data))
>> + return getmissingattr(tupleDesc, attnum, isnull);
>> + else
>> + return fastgetattr(tup, attnum, tupleDesc, isnull);
>> + }
>> +
>> + return heap_getsysattr(tup, attnum, tupleDesc, isnull);
>> +}
> That was the first thing I wrote, but I can't get myself to like it.
> For this one function the code flow is obvious enough; but if you apply
> the same idea to fastgetattr(), the result is not nice at all.

I like your first patch. That is more of a functional style, whereas
the above is more of a procedural style.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-03-24 16:46:43 Re: role self-revocation
Previous Message Peter Eisentraut 2022-03-24 16:40:46 Re: turn fastgetattr and heap_getattr to inline functions