Re: pg_filedump 9.3: checksums (and a few other fixes)

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_filedump 9.3: checksums (and a few other fixes)
Дата
Msg-id 20130614160736.GI19500@alap2.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_filedump 9.3: checksums (and a few other fixes)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_filedump 9.3: checksums (and a few other fixes)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2013-06-14 11:59:04 -0400, Tom Lane wrote:
> Jeff Davis <pgsql@j-davis.com> writes:
> > I have a question about the commit though: shouldn't both functions be
> > static if they are in a .h file? Otherwise, it could lead to naming
> > conflicts. I suppose it's wrong to include the implementation file
> > twice, but it still might be confusing if someone tries. Two ideas that
> > come to mind are:
> >   * make both static and then have a trivial wrapper in checksum.c
> >   * export one or both functions, but use #ifndef CHECKSUM_IMPL_H to
> > prevent redefinition
> 
> Ah, you are right, I forgot the #ifndef CHECKSUM_IMPL_H dance.  Will fix
> in a bit.

That won't help against errors if it's included in two different
files/translation units though. I don't really see a valid case where it
could be validly be included multiple times in one TU?
If anything we should #error in that case, but I am not sure it's worth
bothering.
E.g. in rmgrlist.h we have the following comment:
/* there is deliberately not an #ifndef RMGRLIST_H here */
and I think the reasoning behind that comment applies here as well.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: refresh materialized view concurrently
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Patch for fail-back without fresh backup