Skip to content

Commit 00ead8c

Browse files
committed
Fix for older ruby 2.6 or earlier
1 parent a7be401 commit 00ead8c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ext/zlib/zlib.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#define RUBY_ZLIB_VERSION "1.0.0"
2929

30+
#ifndef RB_PASS_CALLED_KEYWORDS
31+
# define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass)
32+
#endif
33+
3034
#ifndef GZIP_SUPPORT
3135
#define GZIP_SUPPORT 1
3236
#endif
@@ -1061,9 +1065,14 @@ zstream_run(struct zstream *z, Bytef *src, long len, int flush)
10611065
}
10621066

10631067
loop:
1068+
#ifndef RB_NOGVL_UBF_ASYNC_SAFE
1069+
err = (int)(VALUE)rb_thread_call_without_gvl(zstream_run_func, (void *)&args,
1070+
zstream_unblock_func, (void *)&args);
1071+
#else
10641072
err = (int)(VALUE)rb_nogvl(zstream_run_func, (void *)&args,
10651073
zstream_unblock_func, (void *)&args,
10661074
RB_NOGVL_UBF_ASYNC_SAFE);
1075+
#endif
10671076

10681077
if (flush != Z_FINISH && err == Z_BUF_ERROR
10691078
&& z->stream.avail_out > 0) {

0 commit comments

Comments
 (0)