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/common_field_optimization.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/unicorn_http/common_field_optimization.h') diff --git a/ext/unicorn_http/common_field_optimization.h b/ext/unicorn_http/common_field_optimization.h index 4b9f062..0659fc7 100644 --- a/ext/unicorn_http/common_field_optimization.h +++ b/ext/unicorn_http/common_field_optimization.h @@ -77,7 +77,7 @@ static VALUE str_new_dd_freeze(const char *ptr, long len) } /* this function is not performance-critical, called only at load time */ -static void init_common_fields(VALUE mark_ary) +static void init_common_fields(void) { int i; struct common_field *cf = common_http_fields; @@ -95,7 +95,7 @@ static void init_common_fields(VALUE mark_ary) memcpy(tmp + HTTP_PREFIX_LEN, cf->name, cf->len + 1); cf->value = str_new_dd_freeze(tmp, HTTP_PREFIX_LEN + cf->len); } - rb_ary_push(mark_ary, cf->value); + rb_gc_register_mark_object(cf->value); } } -- cgit v1.2.3-24-ge0c7