Re: Autoconf, libpq and replacement function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Autoconf, libpq and replacement function
Date: 2008-11-20 21:15:59
Message-ID: 8084.1227215759@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> Tom Lane wrote:
>> Not really. I'd suggest making the callers do something like
>>
>> #ifdef HAVE_FNMATCH
>> #include <fnmatch.h>
>> #else
>> #include "port/pg_fnmatch.h"
>> #endif

> How's that actually different from the
> #ifdef HAVE_FNMATCH
> #include <fnmatch.h> <-- happens in fe-secure.c
> #else
> #define .... <-- happens in port.h
> #endif

What's bothering me is that port.h gets included *everywhere*, and
might perhaps conflict with some indirect or accidental inclusion
of <fnmatch.h>.

It would also allow someone to forget the
#ifdef HAVE_FNMATCH
#include <fnmatch.h>
#endif
part and have it still work, if they were testing on a broken platform.
It's better that both inclusions appear together instead of having the
alternative code paths effectively appear in two unrelated files.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-11-20 21:20:11 Re: Autoconf, libpq and replacement function
Previous Message Tom Lane 2008-11-20 21:11:50 Re: array_agg and array_accum (patch)