diff options
author | KJ Tsanaktsidis <[email protected]> | 2023-10-16 09:45:01 +1100 |
---|---|---|
committer | git <[email protected]> | 2023-10-26 02:17:54 +0000 |
commit | ac4d687656b0350879ea2e033d2f13d1765a7ce3 (patch) | |
tree | 09df3143a70d60f9d331c5eb5358f3d54af706eb /ext/zlib/zlib.c | |
parent | 3ef7b632a07025472ac7a7f18f6433c089d7be88 (diff) |
[ruby/zlib] Fix misdetection of {crc32,alder32}_z in cloudflare zlib fork
We use the Cloudflare fork of zlib
(https://github.com/cloudflare/zlib), which we find gives improved
performance on AWS Graviton ARM instances. That fork does not define
crc32_z and alder32_z functions.
Until two days ago, Ruby's zlib gem worked fine, because cloudflare zlib
_also_ did not define z_size_t, which meant Ruby did not try and use
these functions.
Since https://github.com/cloudflare/zlib/commit/a3ba99596d6271224d39ef9d6853511f51821e05
however, cloudflare zlib _does_ define z_size_t (but NOT crc32_z or
alder32_z). The zlib gem would try and use these nonexistant
functions and not compile.
This patch fixes it by actually specifically detecting the functions
that the gem wants to call, rather than just the presence of the
z_size_t type.
https://github.com/ruby/zlib/commit/c96e8b9a57
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r-- | ext/zlib/zlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index ef6e8921ba..292e6404a7 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -44,7 +44,7 @@ #endif #endif -#if defined(HAVE_TYPE_Z_SIZE_T) +#if defined(HAVE_ZLIB_SIZE_T_FUNCS) typedef uLong (*checksum_func)(uLong, const Bytef*, z_size_t); # define crc32 crc32_z # define adler32 adler32_z @@ -388,7 +388,7 @@ rb_zlib_version(VALUE klass) # define mask32(x) (x) #endif -#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_TYPE_Z_SIZE_T) +#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_ZLIB_SIZE_T_FUNCS) static uLong checksum_long(uLong (*func)(uLong, const Bytef*, uInt), uLong sum, const Bytef *ptr, long len) { |