Re: pgindent weirdness

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgindent weirdness
Дата
Msg-id 28426.1303316942@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgindent weirdness  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: pgindent weirdness  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> But in any case, *none* of the individual files knows about 
> BulkInsertStateData as a typedef:
> ...
> And the reason is actually fairly obvious on closer inspection. The only 
> place we actually use the BulkInsertStateData typedef (as opposed to the 
> struct declaration) is here:

>     ./backend/access/heap/heapam.c:    bistate = (BulkInsertState)
>     palloc(sizeof(BulkInsertStateData));

> and that sizeof operation will be resolved at compile time and never hit 
> the symbol table.

Oh, interesting.  So you're saying that for this mechanism to know that
"foo" is a typedef, there has to be at least one variable in the code
that's declared as being of type foo or foo *?  (Where "variable" would
include function parameters, fields of other structs, etc.)

That's probably fine, because otherwise we'd have the typedef list
cluttered with junk we don't care about from system headers.

So in the case at hand, we actually *need* to remove the "struct" from
RelationGetBufferForTuple's declaration, so that BulkInsertStateData
gets used as a typedef name in that way.
        regards, tom lane


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: pgindent weirdness
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pgindent weirdnessf