Date: Fri, 26 Mar 2010 11:34:00 -0700 From: Xin LI <delphij@delphij.net> To: freebsd-arch@freebsd.org, ports@freebsd.org Cc: Alexander Logvinov <avl@logvinov.com>, the_paya@gentoo.org Subject: [RFC] Reduce namespace pollution on zlib.h Message-ID: <4BACFE18.7010309@delphij.net>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, The recent zlib import has added some assumption that _LARGEFILE_64_SOURCE is only defined on systems with System V style *64 interface. Moreover, I have added _FILE_OFFSET_BITS = 64 definition into zconf.h so that it would pick up the 64 bit interface properly. This unfortunately could cause some namespace pollution. As such, I would propose the attached changes to zlib headers: zconf.h: * If _LARGEFILE_64_SOURCE is defined, set __FreeBSD_LARGEFILE_64_SOURCE and undefine it, as it would break zlib.h * If _FILE_OFFSET_BITS is undefined, set __FreeBSD_FILE_OFFSET_BITS and define it as 64. zlib.h: * If __FreeBSD_LARGEFILE_64_SOURCE is defined and _LARGEFILE_64_SOURCE undefined, undefine __FreeBSD_LARGEFILE_64_SOURCE and define _LARGEFILE_64_SOURCE. * If __FreeBSD_FILE_OFFSET_BITS is defined and _FILE_OFFSET_BITS is defined, undefine both. This approach is kind of mess, though, but would avoid massive changes which I'd propose for next zlib release. Comments? Objections? Cheers, - -- Xin LI <delphij@delphij.net> http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iQEcBAEBAgAGBQJLrP4XAAoJEATO+BI/yjfBk2YH/Ag38kdtjxAk0l2kdgnHPnZ7 Wf9uk+0ixgE8X2uHfkOeiVO99Ma47aFU/thS1qgXRIWqP/iQEMqOiUayubYnsCJk K8quwzEuifM0hlIPzHxgzo5/e1O6GhUdIkJVJj+T//twG2BGXziYHMye/aph0iRa kW5DEq469jBoz62N8FDn4iatZoXT5boBc0bE3GQCKJhUADbpC84vjCCHfdVx50mu x5hEO88TNaWSn4AkPgs0xPBYQNM+w6t2g/CLNfylumIUVHcSs+v8sLKrxdqqvKNx hn97KmDagy5BVaWaAFAqFclgfAVbjfa8NIaOr8egxnuVHXTzEzjHFUD7fS22Oqo= =eOpg -----END PGP SIGNATURE----- [-- Attachment #2 --] Index: lib/libz/zconf.h =================================================================== --- lib/libz/zconf.h (revision 205651) +++ lib/libz/zconf.h (working copy) @@ -375,6 +375,13 @@ # endif #endif +#if defined(__FreeBSD__) && defined(_LARGEFILE64_SOURCE) +#if !defined(__FreeBSD_LARGEFILE64_SOURCE) +#define __FreeBSD_LARGEFILE64_SOURCE +#endif +#undef _LARGEFILE64_SOURCE +#endif + #ifdef _LARGEFILE64_SOURCE # include <sys/types.h> #endif @@ -391,6 +398,9 @@ #include <sys/types.h> #define z_off_t off_t #ifndef _FILE_OFFSET_BITS +#if !defined(__FreeBSD_FILE_OFFSET_BITS) +#define __FreeBSD_FILE_OFFSET_BITS +#endif #define _FILE_OFFSET_BITS 64 #endif Index: lib/libz/zlib.h =================================================================== --- lib/libz/zlib.h (revision 205651) +++ lib/libz/zlib.h (working copy) @@ -1597,6 +1597,20 @@ ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +#if defined(__FreeBSD_LARGEFILE64_SOURCE) +#undef __FreeBSD_LARGEFILE64_SOURCE +#if !defined(_LARGEFILE64_SOURCE) +#define _LARGEFILE64_SOURCE +#endif +#endif + +#if defined(__FreeBSD_FILE_OFFSET_BITS) +#undef __FreeBSD_FILE_OFFSET_BITS +#if defined(_FILE_OFFSET_BITS) +#undef _FILE_OFFSET_BITS +#endif +#endif + #ifdef __cplusplus } #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BACFE18.7010309>
