Re: GIST code doesn't build on strict 64-bit machines - Mailing list pgsql-hackers

From Tom Lane
Subject Re: GIST code doesn't build on strict 64-bit machines
Date
Msg-id 1682.1080577340@sss.pgh.pa.us
Whole thread Raw
In response to Re: GIST code doesn't build on strict 64-bit machines  (Teodor Sigaev <teodor@sigaev.ru>)
Responses Re: GIST code doesn't build on strict 64-bit machines  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-hackers
Teodor Sigaev <teodor@sigaev.ru> writes:
> I suggest to replace bytea by struct
> typedef struct {
>     int32    n; /* number of GISTENTRY */
>     GISTENTRY  vector[1];
> } GistEntryVector;

Yes, I was thinking the same thing.

> #define GEVHDRSZ    (MAXALIGN(sizeof(int32))
> so, allocation will be:
> evec = palloc( GEVHDRSZ + sizeof(GISTENTRY)*n );
> MAXALIGN guarantee that allocated memory will be no less than required (it may 
> be  greater for 4 bytes).

That would work, or you could use offsetof(GistEntryVector, vector[0]).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: GIST code doesn't build on strict 64-bit machines
Next
From: markw@osdl.org
Date:
Subject: Re: PostgreSQL block size vs. LVM2 stripe width