这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@phprus
Copy link
Contributor

@phprus phprus commented May 26, 2024

Fix #1733

Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
@codecov
Copy link

codecov bot commented May 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.90%. Comparing base (a32e1eb) to head (ebb237e).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1736      +/-   ##
===========================================
- Coverage    82.90%   82.90%   -0.01%     
===========================================
  Files          136      136              
  Lines        10280    10281       +1     
  Branches      2797     2798       +1     
===========================================
  Hits          8523     8523              
  Misses        1060     1060              
- Partials       697      698       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@mtl1979 mtl1979 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM... NULL was originally defined only for C++, but later got added to C too... Later C++ compilers use nullptr instead, so there is no "compatibility" reason to keep this defined as NULL.

@Dead2 Dead2 merged commit 970d1ab into zlib-ng:develop May 27, 2024
@Dead2 Dead2 changed the title Improve source compatibility with zlib Improve Z_NULL compatibility with zlib May 30, 2024
This was referenced May 30, 2024
@Dead2 Dead2 mentioned this pull request Jun 12, 2024
@ac000
Copy link

ac000 commented May 21, 2025

Of course this is now triggered by -Wzero-as-null-pointer-constant (enabled for C in GCC 15, not enabled by either of Wall or Wextra... yet).

src/http/modules/ngx_http_gunzip_filter_module.c:307:26: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
  307 |     ctx->zstream.next_in = Z_NULL;
      |                          ^

@phprus
Copy link
Contributor Author

phprus commented May 22, 2025

zlib also declare Z_NULL macro as 0:

https://github.com/madler/zlib/blob/5a82f71ed1dfc0bec044d9702463dbdf84ea3b71/zlib.h#L216

This macro is only for compatibility with zlib.

Use NULL instead of Z_NULL.

@ac000
Copy link

ac000 commented May 22, 2025

I'm thinking of the case where you have a code base that was developed against zlib but may now build with either zlib or zlib-ng-comat as Linux distributions are now switching to...

No biggie... just an unfortunate legacy decision...

@phprus
Copy link
Contributor Author

phprus commented May 22, 2025

This change was made because defining the Z_NULL macro as NULL broke other legacy code bases :(

There is no reason to use the Z_NULL macro in the code now. This is zlib-compatibility macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Z_NULL isn't fully compatible with zlib

5 participants