Skip to content

Commit

Permalink
Use INT_MAX directly
Browse files Browse the repository at this point in the history
gz_intmax() is just a wrapper around INT_MAX.  Use the real thing.

Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Dec 8, 2024
1 parent 5f65830 commit 2f076dd
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 14 deletions.
3 changes: 1 addition & 2 deletions gzguts.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,4 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
/* 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) */
unsigned ZLIB_INTERNAL gz_intmax(void);
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
8 changes: 0 additions & 8 deletions gzlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,3 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
strcat(state->msg, msg);
#endif
}

/* 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) {
return INT_MAX;
}
1 change: 0 additions & 1 deletion zconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
Expand Down
1 change: 0 additions & 1 deletion zconf.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
Expand Down
1 change: 0 additions & 1 deletion zconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
Expand Down
1 change: 0 additions & 1 deletion zlib.map
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ZLIB_1.2.0 {
zcfree;
z_errmsg;
gz_error;
gz_intmax;
_*;
};

Expand Down

0 comments on commit 2f076dd

Please sign in to comment.