[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a80a05d3-beb5-4545-9a0d-c10efc9fe3a4@linux.ibm.com>
Date: Thu, 6 Feb 2025 18:53:17 +0100
From: Zaslonko Mikhail <zaslonko@...ux.ibm.com>
To: Yury Norov <yury.norov@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Ilya Leoshkevich <iii@...ux.ibm.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
linux-kernel@...r.kernel.org
Cc: Joe Perches <joe@...ches.com>
Subject: Re: [PATCH] lib/zlib: drop EQUAL macro
Hi Yury,
I think the initial idea was to keep the code similar to the userspace zlib for serviceability.
But since it leads to extra warnings, it's worth fixing.
Reviewed-by: Mikhail Zaslonko <zaslonko@...ux.ibm.com>
On 05.02.2025 22:29, Yury Norov wrote:
> The macro is pre-historic, and only exists to help those readers who
> don't know what memcmp() returns if memory areas differ. This is pretty
> well documented, so the macro looks excessive.
>
> Now that the only user of the macro depends on DEBUG_ZLIB config, GCC
> warns about unused macro if the library is built with W=2 against
> defconfig. So drop it for good.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
> scripts/get_maintainer.pl failed to attribute this patch, so adding
> Andrew and recent active developers, and Joe Perches for the script.
>
> $ scripts/get_maintainer.pl 0001-zlib-drop-EQUAL-macro.patch
> Bad divisor in main::vcs_assign: 0
> "GitAuthor: Yury Norov" <yury.norov@...il.com> (authored:1/1=100%,added_lines:1/1=100%,removed_lines:5/5=100%)
> linux-kernel@...r.kernel.org (open list)
>
> lib/zlib_deflate/deflate.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c
> index 3a1d8d34182e..8fb2a3e17c0e 100644
> --- a/lib/zlib_deflate/deflate.c
> +++ b/lib/zlib_deflate/deflate.c
> @@ -151,9 +151,6 @@ static const config configuration_table[10] = {
> * meaning.
> */
>
> -#define EQUAL 0
> -/* result of memcmp for equal strings */
> -
> /* ===========================================================================
> * Update a hash value with the given input byte
> * IN assertion: all calls to UPDATE_HASH are made with consecutive
> @@ -713,8 +710,7 @@ static void check_match(
> )
> {
> /* check that the match is indeed a match */
> - if (memcmp((char *)s->window + match,
> - (char *)s->window + start, length) != EQUAL) {
> + if (memcmp((char *)s->window + match, (char *)s->window + start, length)) {
> fprintf(stderr, " start %u, match %u, length %d\n",
> start, match, length);
> do {
Powered by blists - more mailing lists