From: Zaslonko Mikhail <zaslonko@linux.ibm.com>
To: Yury Norov <yury.norov@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Ilya Leoshkevich <iii@linux.ibm.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org
Cc: Joe Perches <joe@perches.com>
Subject: Re: [PATCH] lib/zlib: drop EQUAL macro
Date: Thu, 6 Feb 2025 18:53:17 +0100 [thread overview]
Message-ID: <a80a05d3-beb5-4545-9a0d-c10efc9fe3a4@linux.ibm.com> (raw)
In-Reply-To: <20250205212933.68695-1-yury.norov@gmail.com>
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@linux.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@gmail.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@gmail.com> (authored:1/1=100%,added_lines:1/1=100%,removed_lines:5/5=100%)
> linux-kernel@vger.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 {
prev parent reply other threads:[~2025-02-06 17:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 21:29 [PATCH] lib/zlib: drop EQUAL macro Yury Norov
2025-02-06 17:53 ` Zaslonko Mikhail [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a80a05d3-beb5-4545-9a0d-c10efc9fe3a4@linux.ibm.com \
--to=zaslonko@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=iii@linux.ibm.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox