]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove NIL preprocessor macro which isn't consistently enforced.
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 20 Sep 2020 17:51:05 +0000 (10:51 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 23 Sep 2020 15:00:11 +0000 (17:00 +0200)
deflate.c
deflate.h
deflate_slow.c

index 86842debfa957d73ea2afd89a299f1bc49bbb162..a1553aaf46041d4b1821d97804498616d8e51dfc 100644 (file)
--- 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 */
index b42dc28d29c91871e7d31b1da843199b0b509076..cf4afb9576bf0d2ac9462f047b5f77c4f3c301c6 100644 (file)
--- a/deflate.h
+++ b/deflate.h
 #  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
index af2f284494d09e25fe86482081ca2772de5cde23..ea5eed8448c733cf79cdc52c9502a85444bec9c9 100644 (file)
@@ -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).