From c43db38a74411a4752b02f5066ee5cc90a8e2ca0 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 25 Mar 2022 00:42:27 +0000 Subject: [PATCH] Sync zlib with userland Backport zlib fix for the multi line CLEAR_HASH macro. There is an else branch where only half of the macro is executed conditionally. Acording to upstream comment this has only little impact. https://github.com/madler/zlib/commit/38e8ce32afbaa82f67d992b9f3056f281fe69259 ok bluhm (who had the same diff) --- sys/lib/libz/deflate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/lib/libz/deflate.c b/sys/lib/libz/deflate.c index 1f87e05186a..0f3931bf076 100644 --- a/sys/lib/libz/deflate.c +++ b/sys/lib/libz/deflate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: deflate.c,v 1.6 2021/07/28 07:36:06 tb Exp $ */ +/* $OpenBSD: deflate.c,v 1.7 2022/03/25 00:42:27 tb Exp $ */ /* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h @@ -187,8 +187,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.20.1