Re: [PATCH] Simplify trivial shmem size calculations - Mailing list pgsql-hackers

From Tender Wang
Subject Re: [PATCH] Simplify trivial shmem size calculations
Date
Msg-id CAHewXN=haH3hw_X06UyHE2t9KjzFFKTcX2KQXz427YJ2aekLOA@mail.gmail.com
Whole thread
In response to Re: [PATCH] Simplify trivial shmem size calculations  (Junwang Zhao <zhjwpku@gmail.com>)
List pgsql-hackers
Hi,

Junwang Zhao <zhjwpku@gmail.com> 于2026年3月10日周二 21:32写道:

> > And I also found another case:
> > Size
> > XLogRecoveryShmemSize(void)
> > {
> >     Size        size;
> >
> >     /* XLogRecoveryCtl */
> >     size = sizeof(XLogRecoveryCtlData);
> >
> >     return size;
> > }
> >
> > The above code does not need to define the local variable size;
> > directly returning sizeof(XLogRecoveryCtlData) seems simpler.
>
> I bet the compiler will optimize it away.

Yeah,  XLogRecoveryShmemSize() may be optimized by the compiler,  I only
want the codes to look more consistent.

>I think it's fine as it is.
Ok.

--
Thanks,
Tender Wang



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Streamify more code paths
Next
From: Tomas Vondra
Date:
Subject: Re: Remove header lock BufferGetLSNAtomic() on architectures with 64 bit atomic operations