apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: FreeBSD 4.2 breakage (?)
Date Tue, 06 Feb 2001 01:11:32 GMT
[ bringing this conversation just to dev@apr at this point ]

On Mon, Feb 05, 2001 at 06:09:45PM -0500, Greg Hudson wrote:
> > I spent a good amount of time trying to figure out the right
> > combination to allow us to include <string.h> and <strings.h> (which
> > is done by apr_want.h) without some redundant declaration warnings.
> 
> Can we change apr_want.h not to include <strings.h> if
> APR_HAVE_STRING_H is defined?

Not at this time. There are users of strcasecmp(), so the explicit inclusion
of strings.h is needed to pick that up.

[ it was the duplicate declaration of strcasecmp and friends which led me
  down this road. ]

I don't know what the POSIX equivalent of strcasecmp is, but am quite
willing to update code to switch over to it.

> > Removing redundant-decl was the easy fix, but I didn't think it was
> > the right fix. Removing POSIX_SOURCE is also the easy fix, but I
> > don't think the right fix :-)
> 
> Well, it is certainly wrong to define _POSIX_SOURCE and then include
> <strings.h>, even if it doesn't happen to break anything at the
> moment like <sys/socket.h> does.
> 
> I notice that apr_file_io.h also drags in <sys/uio.h>, also a
> non-POSIX header.  Once again, _POSIX_SOURCE is not compatible with
> this behavior.

Fine. Then we clean out the sys/socket include and the sys/uio include. I'll
do so this evening.

I don't have a ready solution for strings.h, however. Because we *do* use
strcasecmp, I don't know a better way to pick it up. I don't want to rely on
/not/ including strings.h if string.h is present. Who knows if string.h will
define strcasecmp? GNU's happens to do so, but what about elsewhere? From
that point, I said "gotta include both. now how do I prevent the extra
definition of strcasecmp?"

Even if we ultimately back out the POSIX_SOURCE thing, cleaning out the
BSDisms from internal and public APR will assist with portability.
[ I'm presuming that POSIX is more portable than BSDisms ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message