]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix CLEAR_HASH macro to be usable as a single statement.
authorMark Adler <madler@alumni.caltech.edu>
Mon, 23 Jan 2017 07:38:52 +0000 (23:38 -0800)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 15 Jan 2019 10:00:10 +0000 (11:00 +0100)
As it is used in deflateParams().

deflate.c

index bdf6f21109512396fd3d26bdf4d1bb299ede7956..30c6d9847e695af1d138c6e19a01eb9104e60566 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -153,9 +153,10 @@ static const config configuration_table[10] = {
  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
  * prev[] will be initialized on the fly.
  */
-#define CLEAR_HASH(s) \
-    s->head[s->hash_size-1] = NIL; \
-    memset((unsigned char *)s->head, 0, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+#define CLEAR_HASH(s) do {                                                                \
+    s->head[s->hash_size - 1] = NIL;                                                      \
+    memset((unsigned char *)s->head, 0, (unsigned)(s->hash_size - 1) * sizeof(*s->head)); \
+  } while (0)
 
 /* ===========================================================================
  * Slide the hash table when sliding the window down (could be avoided with 32