zlib/backport-Fix-CLEAR_HASH-macro-to-be-usable-as-a-single-statem.patch
zhoupengcheng fce1c5536a zlib:backport upstream patch
(cherry picked from commit ee65ab90886d1240dc7ef6b6afc98012d7c18b2a)
2024-05-07 19:57:31 +08:00

35 lines
1.1 KiB
Diff

From 38e8ce32afbaa82f67d992b9f3056f281fe69259 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Sun, 22 Jan 2017 23:38:52 -0800
Subject: [PATCH] Fix CLEAR_HASH macro to be usable as a single statement.
As it is used in deflateParams().
Reference:https://github.com/madler/zlib/commit/38e8ce32afbaa82f67d992b9f3056f281fe69259
Conflict:NA
---
deflate.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/deflate.c b/deflate.c
index e97bd87..568eadd 100644
--- 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
--
2.23.0