From 01253ecd7e0a01d311670f2d03c61b82fc12d338 Mon Sep 17 00:00:00 2001 From: Milan Bulat Date: Mon, 9 Oct 2023 17:04:51 +0400 Subject: Make the existence of gz_intmax() unconditional. gz_intmax() is noted in zlib.map. This assures it's always there. --- gzlib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gzlib.c') diff --git a/gzlib.c b/gzlib.c index 29fc448..9c103db 100644 --- a/gzlib.c +++ b/gzlib.c @@ -563,20 +563,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) { #endif } -#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 ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} -- cgit v1.2.3-55-g6feb