From 2a6cb76d5010cb763ef5a2c305728465d15eb7c9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 26 Dec 2018 04:51:31 +0000 Subject: use rb_gc_register_mark_object Since Ruby 2.6, it's a documented part of the API and we may depend on it: https://bugs.ruby-lang.org/issues/9894 It's been around since the early Ruby 1.9 days, and reduces overhead compared to relying on rb_global_variable: https://bogomips.org/unicorn-public/20170301002854.29198-1-e@80x24.org/ --- ext/unicorn_http/httpdate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/unicorn_http/httpdate.c') diff --git a/ext/unicorn_http/httpdate.c b/ext/unicorn_http/httpdate.c index 2381cff..b59d038 100644 --- a/ext/unicorn_http/httpdate.c +++ b/ext/unicorn_http/httpdate.c @@ -64,13 +64,13 @@ static VALUE httpdate(VALUE self) return buf; } -void init_unicorn_httpdate(VALUE mark_ary) +void init_unicorn_httpdate(void) { VALUE mod = rb_define_module("Unicorn"); mod = rb_define_module_under(mod, "HttpResponse"); buf = rb_str_new(0, buf_capa - 1); - rb_ary_push(mark_ary, buf); + rb_gc_register_mark_object(buf); buf_ptr = RSTRING_PTR(buf); httpdate(Qnil); -- cgit v1.2.3-24-ge0c7