]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove gz_intmax implementation, since INT_MAX is always available in modern C implem...
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 13 Dec 2021 15:24:20 +0000 (16:24 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 19 Dec 2021 14:40:52 +0000 (15:40 +0100)
gzguts.h
gzlib.c
zlib-ng.map
zlib.map
zlib_name_mangling-ng.h.in
zlib_name_mangling.h.in

index c42587470ec99e3fc7e46ae1f196c63d77e39665..4e71eb4b1b94f247a1abb98c7d5c501670f338dd 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
@@ -144,11 +144,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_ */
diff --git a/gzlib.c b/gzlib.c
index 490551667af9bb8e2b7d4f52c0150a3e270afbb6..c19284035c14ab4f42818a7c9ab86ad84433d710 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -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
index b0046034cf15bdb2c4f525b1004ac84f235a9be9..461c2566e194d7b945d68d699f843a2616d12622 100644 (file)
@@ -66,7 +66,6 @@ ZLIB_NG_2.0.0 {
     zng_zcfree;
     zng_z_errmsg;
     zng_gz_error;
-    zng_gz_intmax;
     _*;
 };
 
index f608f2bd519433fc31027507cc56ff819a82eb31..fccc0e129db22868a4234ca140288ca8a1fa7b86 100644 (file)
--- a/zlib.map
+++ b/zlib.map
@@ -15,7 +15,6 @@ ZLIB_1.2.0 {
     zcfree;
     z_errmsg;
     gz_error;
-    gz_intmax;
     _*;
 };
 
index 7c754fc1e6de02962810bd380211ce4b015d0bea..627ed46510691e808f9a567361f7a36338f03929 100644 (file)
@@ -48,7 +48,6 @@
 #define zng_get_crc_table         @ZLIB_SYMBOL_PREFIX@zng_get_crc_table
 #ifndef Z_SOLO
 #  define zng_gz_error              @ZLIB_SYMBOL_PREFIX@zng_gz_error
-#  define zng_gz_intmax             @ZLIB_SYMBOL_PREFIX@zng_gz_intmax
 #  define zng_gz_strwinerror        @ZLIB_SYMBOL_PREFIX@zng_gz_strwinerror
 #  define zng_gzbuffer              @ZLIB_SYMBOL_PREFIX@zng_gzbuffer
 #  define zng_gzclearerr            @ZLIB_SYMBOL_PREFIX@zng_gzclearerr
index 07265f3c1ada4605960b729cbd9a4094b6d2ab08..22d458b1c9df21e6ead3596b7ca0c266f1f58aeb 100644 (file)
@@ -48,7 +48,6 @@
 #define get_crc_table         @ZLIB_SYMBOL_PREFIX@get_crc_table
 #ifndef Z_SOLO
 #  define gz_error              @ZLIB_SYMBOL_PREFIX@gz_error
-#  define gz_intmax             @ZLIB_SYMBOL_PREFIX@gz_intmax
 #  define gz_strwinerror        @ZLIB_SYMBOL_PREFIX@gz_strwinerror
 #  define gzbuffer              @ZLIB_SYMBOL_PREFIX@gzbuffer
 #  define gzclearerr            @ZLIB_SYMBOL_PREFIX@gzclearerr