From: Nathan Moinvaziri Date: Sun, 20 Sep 2020 17:51:05 +0000 (-0700) Subject: Remove NIL preprocessor macro which isn't consistently enforced. X-Git-Tag: 1.9.9-b1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c58894c679f8d4e930715bc3b670481c0854431;p=thirdparty%2Fzlib-ng.git Remove NIL preprocessor macro which isn't consistently enforced. --- diff --git a/deflate.c b/deflate.c index 86842debf..a1553aaf4 100644 --- a/deflate.c +++ b/deflate.c @@ -126,9 +126,6 @@ extern void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned lo * Local data */ -#define NIL 0 -/* Tail of hash chains */ - /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be @@ -202,7 +199,7 @@ Z_INTERNAL void slide_hash_c(deflate_state *s) { do { unsigned m; m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); + *p = (Pos)(m >= wsize ? m-wsize : 0); } while (--n); #else /* As of I make this change, gcc (4.8.*) isn't able to vectorize @@ -219,7 +216,7 @@ Z_INTERNAL void slide_hash_c(deflate_state *s) { for (i = 0; i < n; i++) { Pos m = *q; Pos t = wsize; - *q++ = (Pos)(m >= t ? m-t: NIL); + *q++ = (Pos)(m >= t ? m-t: 0); } } #endif /* NOT_TWEAK_COMPILER */ @@ -230,7 +227,7 @@ Z_INTERNAL void slide_hash_c(deflate_state *s) { do { unsigned m; m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); + *p = (Pos)(m >= wsize ? m-wsize : 0); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ @@ -242,7 +239,7 @@ Z_INTERNAL void slide_hash_c(deflate_state *s) { for (i = 0; i < n; i++) { Pos m = *q; Pos t = wsize; - *q++ = (Pos)(m >= t ? m-t: NIL); + *q++ = (Pos)(m >= t ? m-t: 0); } } #endif /* NOT_TWEAK_COMPILER */ diff --git a/deflate.h b/deflate.h index b42dc28d2..cf4afb957 100644 --- a/deflate.h +++ b/deflate.h @@ -21,10 +21,6 @@ # define GZIP #endif -#define NIL 0 -/* Tail of hash chains */ - - /* =========================================================================== * Internal compression state. */ @@ -157,7 +153,7 @@ typedef struct internal_state { * An index in this array is thus a window index modulo 32K. */ - Pos *head; /* Heads of the hash chains or NIL. */ + Pos *head; /* Heads of the hash chains or 0. */ int block_start; /* Window position at the beginning of the current output block. Gets diff --git a/deflate_slow.c b/deflate_slow.c index af2f28449..ea5eed844 100644 --- a/deflate_slow.c +++ b/deflate_slow.c @@ -38,7 +38,7 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ - hash_head = NIL; + hash_head = 0; if (LIKELY(s->lookahead >= MIN_MATCH)) { hash_head = functable.quick_insert_string(s, s->strstart); } @@ -48,7 +48,7 @@ Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { s->prev_match = (Pos)s->match_start; match_len = MIN_MATCH-1; - if (hash_head != NIL && s->prev_length < s->max_lazy_match && s->strstart - hash_head <= MAX_DIST(s)) { + if (hash_head != 0 && s->prev_length < s->max_lazy_match && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file).