]> git.lizzy.rs Git - zlib.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)
committerMark Adler <madler@alumni.caltech.edu>
Thu, 16 Feb 2017 06:39:26 +0000 (22:39 -0800)
As it is used in deflateParams().

deflate.c

index e97bd878341166e295d272a11204338a2b9233f4..568eaddbe915eeae9a6998bb4e443a10c054b543 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -190,8 +190,11 @@ local const config configuration_table[10] = {
  * prev[] will be initialized on the fly.
  */
 #define CLEAR_HASH(s) \
-    s->head[s->hash_size-1] = NIL; \
-    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+    do { \
+        s->head[s->hash_size-1] = NIL; \
+        zmemzero((Bytef *)s->head, \
+                 (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+    } while (0)
 
 /* ===========================================================================
  * Slide the hash table when sliding the window down (could be avoided with 32