From: Mark Adler Date: Thu, 2 Feb 2012 07:47:47 +0000 (-0800) Subject: Avoid library header include in crc32.c for Z_SOLO. X-Git-Tag: v1.2.6.1~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9e4edc99629ae10e3cfd7091a4742e4e4e2dbec;p=thirdparty%2Fzlib-ng.git Avoid library header include in crc32.c for Z_SOLO. crc32.c was #including limits.h in order to find a four-byte integer type. It was doing this even if Z_SOLO were defined, violating the intent of Z_SOLO, which is to include no library headers and require no library functions. Now crc32.c obeys the intent of Z_SOLO, but with the downside that crc32() will be slower than when not compiled with Z_SOLO. This can be remedied manually by typedefing u4 to a known four-byte unsigned integer type, and #defining BYFOUR in crc32.c. --- diff --git a/crc32.c b/crc32.c index c12471e61..ddf0025c0 100644 --- a/crc32.c +++ b/crc32.c @@ -33,6 +33,9 @@ #define local static /* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifdef Z_SOLO +# define NOBYFOUR +#endif #ifndef NOBYFOUR # ifdef STDC /* need ANSI C limits.h to determine sizes */ # include