[syslog-ng] HAVE_GETUTENT not defined

Bryan Henderson bryanh at giraffe-data.com
Mon Jan 29 22:15:32 CET 2007


>>> BTW, I recommend not using a standard function name for a local function.
>>> E.g. in this case, the local version of getutent is called getutent.  That
>>> misled me for a while, because I assumed syslog-ng was actually calling
>>> standard getutent.  It would be better for it to call syslogng_getutent()
>>> and have that call the real getutent() if it's available.
>
>I don't want to add #ifdefs to the calling side of things. I know I
>could use macros, but then the calling side would not indicate that
>there's a private function implemented.

I'm with you on that, but I was suggesting something different.  There
is today an #ifdef in utils.c like this:

#ifndef HAVE_GETUTENT

struct utmp *getutent(void)
{
...
}
#endif

What I think works better is:

#ifndef HAVE_GETUTENT
struct utmp *my_getutent(void)
{
   ...
}
#else
struct utmp *my_getutent(void) 
{
    return getutent();
}

#endif

Or put the #ifdef inside my_getutent() or make my_getutent a macro.

In any case, it eliminates more confusion and with less clutter than a
comment saying "this getutent might not be the one you're thinking
of".

-- 
Bryan Henderson                                   San Jose, California


More information about the syslog-ng mailing list