Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)
Date: 2011-08-08 16:27:17
Message-ID: 1312820668-sup-9972@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Alexander Korotkov's message of lun ago 08 11:50:53 -0400 2011:
> On Mon, Aug 8, 2011 at 7:43 PM, Alvaro Herrera
> <alvherre(at)commandprompt(dot)com>wrote:
>
> > Maybe this needs to use the new FLEXIBLE_ARRAY_MEMBER stuff. Can you try
> > that please?
>
>
> typedef struct relopt_string
> {
> relopt_gen gen;
> int default_len;
> bool default_isnull;
> validate_string_relopt validate_cb;
> char default_val[1]; /* variable length, zero-terminated */
> } relopt_string;
>
> static relopt_string stringRelOpts[] =
> ...
>
> I doubt variable-length data structure is possible in this case, because we
> don't have array of pointers to relopt_string, but just array
> of relopt_string. May be just
> char *default_val;
> is possible?

An array of relopt_string? Isn't that a bit strange? If I recall
correctly, the point of this was to be able to allocate the
relopt_string struct and the char array itself as a single palloc unit,
in a single call somewhere in the reloptions API (which was convoluted
in some points precisely to let the string case work). I don't have the
details of this fresh in my mind though. It certainly worked with more
than one string option when I committed it, IIRC.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-08-08 16:33:45 Re: [RFC] Common object property boards
Previous Message Alvaro Herrera 2011-08-08 16:22:48 Re: [RFC] Common object property boards