Skip to content

Commit

Permalink
Avoid library header include in crc32.c for Z_SOLO.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
madler committed Feb 2, 2012
1 parent 55b8b5f commit f9e4edc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <limits.h>
Expand Down

0 comments on commit f9e4edc

Please sign in to comment.