Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Sep 1998 14:16:18 +0200
From:      Martin Cracauer <cracauer@cons.org>
To:        Niall Smart <nialls@euristix.ie>, hackers@FreeBSD.ORG
Subject:   Re: Quick code style question.
Message-ID:  <19980923141618.A21991@cons.org>
In-Reply-To: <98Sep23.123042bst.19713@gateway.euristix.ie>; from Niall Smart on Wed, Sep 23, 1998 at 11:10:38AM %2B0100
References:  <98Sep23.123042bst.19713@gateway.euristix.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
In <98Sep23.123042bst.19713@gateway.euristix.ie>, Niall Smart wrote: 
> Hi,
> 
> I was adding support for an environment variable which specifies an
> alternate /etc/services file for getservent() et al when I noticed
> that netdb.h exports a private interface used internally in libc:
> 
> /*
>  * PRIVATE functions specific to the FreeBSD implementation
>  */
> 
> /* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
> void    _sethosthtent __P((int));
> void    _endhosthtent __P((void));
> void    _sethostdnsent __P((int));
> [snip]
> 
> Surely it would be much better if these were either protected by a
> _NETDB_INTERNAL_ macro or moved into a separate header in lib/libc/net.
> Which of these two is preferable?

Not speaking for the FreeBSD project and not commenting on your
getservent() changes, I think the macros would do. The amount of
information for the new header file is small and it would be
consistent with #ifdef KERNEL in sys/ and machine/. FreeBSD generally
doesn't use sperate header files for private information.

On the technical side, the macro solution is also better because it
easily supports more than two levels of visibility and it is easy to
raise or lower the level of visibilty from inside another header
file or on the compiler command line.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer
BSD User Group Hamburg, Germany     http://www.bsdhh.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980923141618.A21991>