From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Amul Sul <sulamul(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Convert macros to static inline functions |
Date: | 2022-05-16 15:48:28 |
Message-ID: | 202205161548.7cjsl2hdmhas@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2022-May-16, Amul Sul wrote:
> +static inline OffsetNumber
> +PageGetMaxOffsetNumber(Page page)
> +{
> + if (((PageHeader) page)->pd_lower <= SizeOfPageHeaderData)
> + return 0;
> + else
> + return ((((PageHeader) page)->pd_lower - SizeOfPageHeaderData)
> / sizeof(ItemIdData));
> +}
>
> The "else" is not necessary, we can have the return statement directly
> which would save some indentation as well. The Similar pattern can be
> considered for 0004 and 0007 patches as well.
Yeah. In these cases I propose to also have a local variable so that
the cast to PageHeader appears only once.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Pryzby | 2022-05-16 16:02:39 | Re: First draft of the PG 15 release notes |
Previous Message | Peter Eisentraut | 2022-05-16 15:48:08 | Re: [RFC] building postgres with meson -v8 |