diff options
author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2021-12-13 16:24:20 +0100 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2023-03-17 21:27:56 +0100 |
commit | f9f7023b5f52aee6f7a36fe79c982c05ffa1be85 (patch) | |
tree | 2a1183a49a374c1de9fb67a4863519e484966f9b | |
parent | 38284110216673a4ffd5c70b6757b0cab75c8536 (diff) |
Remove gz_intmax implementation, since INT_MAX is always available in modern C implementations.
-rw-r--r-- | gzguts.h | 7 | ||||
-rw-r--r-- | gzlib.c | 18 | ||||
-rw-r--r-- | zlib-ng.map | 1 | ||||
-rw-r--r-- | zlib.map | 1 |
4 files changed, 1 insertions, 26 deletions
@@ -140,11 +140,6 @@ void Z_INTERNAL gz_error(gz_state *, int, const char *); /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned Z_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) #endif /* GZGUTS_H_ */ @@ -523,21 +523,3 @@ void Z_INTERNAL gz_error(gz_state *state, int err, const char *msg) { } (void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, "%s%s%s", state->path, ": ", msg); } - -#ifndef INT_MAX -/* portably return maximum value for an int (when limits.h presumed not - available) -- we need to do this to cover cases where 2's complement not - used, since C standard permits 1's complement and sign-bit representations, - otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned Z_INTERNAL gz_intmax() { - unsigned p, q; - - p = 1; - do { - q = p; - p <<= 1; - p++; - } while (p > q); - return q >> 1; -} -#endif diff --git a/zlib-ng.map b/zlib-ng.map index b004603..461c256 100644 --- a/zlib-ng.map +++ b/zlib-ng.map @@ -66,7 +66,6 @@ ZLIB_NG_2.0.0 { zng_zcfree; zng_z_errmsg; zng_gz_error; - zng_gz_intmax; _*; }; @@ -15,7 +15,6 @@ ZLIB_1.2.0 { zcfree; z_errmsg; gz_error; - gz_intmax; _*; }; |