Re: MemSet inline for newNode - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: MemSet inline for newNode
Date
Msg-id 200211111640.gABGe2U02117@candle.pha.pa.us
Whole thread Raw
In response to Re: MemSet inline for newNode  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: MemSet inline for newNode  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I still test the palloc pointer alignment in MemSetLoop because that is
> > not a constant.
>
> But it's known aligned when you just got it from palloc.
>
> Why don't you simply implement what was agreed to in the original
> thread, namely:
>
>     * provide a MemSetAligned macro that is just like the standard
>       one except it omits the pointer alignment test
>
>     * provide a palloc0 macro that does MemSetAligned inside the
>       macro; known safe because palloc returns a maxaligned pointer

I can't do MemSet in a macro that returns a value, as palloc requires.
MemSet has a loop, and that can't be done in a macro that returns a value.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: MemSet inline for newNode
Next
From: Peter Eisentraut
Date:
Subject: Re: minor SGML fix