lib/zlib: drop EQUAL macro
PATCH 1/1 lib/zlib: drop EQUAL macro
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.
---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" <[email protected]> (authored:1/1=100%,added_lines:1/1=100%,removed_lines:5/5=100%) [email protected] (open list)
lib/zlib_deflate/deflate.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
lib/zlib_deflate/deflate.c +1 -5
@@ -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 {
Signature · 1 line
2.43.0
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.
Quoted 45 lines · Yury Norov
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_ZLIBconfig, 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 <[email protected]>---
scripts/get_maintainer.plfailed 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" <[email protected]> (authored:1/1=100%,added_lines:1/1=100%,removed_lines:5/5=100%) [email protected] (open list)lib/zlib_deflate/deflate.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)lib/zlib_deflate/deflate.c +1
-5@@ -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 {