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

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)
Дата
Msg-id 1312820668-sup-9972@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)  (Alexander Korotkov <aekorotkov@gmail.com>)
Ответы Re: Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)  (Alexander Korotkov <aekorotkov@gmail.com>)
Список 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@commandprompt.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@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [RFC] Common object property boards
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [RFC] Common object property boards