Teodor Sigaev <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to