apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guenter Knauf <fua...@apache.org>
Subject APR_WANT_IOVEC in apr_want.h
Date Sun, 27 Mar 2011 17:14:31 GMT
I was just looking at this part again (BZ#50146):

#ifdef APR_WANT_IOVEC

#if APR_HAVE_IOVEC

#if APR_HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif

#else

struct iovec
{
     void *iov_base;
     size_t iov_len;
};

#endif

/* apr_want is included at several layers; redefining APR_HAVE_IOVEC
  * now to ensure that our struct is not introduced several times.
  */
#undef APR_HAVE_IOVEC
#define APR_HAVE_IOVEC 1

#undef APR_WANT_IOVEC
#endif

I think setting APR_HAVE_IOVEC in case of defining struct iovec is 
wrong; if apr_want.h is called a 2nd time then it does protect from 
defining struct iovec again, but then the '#include <sys/uio.h>' plugs 
in, and this might be only useless, or may clash on other things if the 
system header is not self protected from including twice ...
therefore I think we should here define an independent macro like 
APR_IOVEC_DEFINED:

#ifdef APR_WANT_IOVEC

#if APR_HAVE_IOVEC

#if APR_HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif

#else

#ifndef APR_IOVEC_DEFINED
#define APR_IOVEC_DEFINED
struct iovec
{
     void *iov_base;
     size_t iov_len;
};
#endif /* !APR_IOVEC_DEFINED */

#endif /* APR_HAVE_IOVEC */

#undef APR_WANT_IOVEC
#endif

I dont believe this fixes BZ#50146, but I think its better this way ...

comments?

Gün.


Mime
View raw message