diff options
author | Eric Wong <e@80x24.org> | 2018-12-26 04:51:31 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-12-26 04:51:31 +0000 |
commit | 2a6cb76d5010cb763ef5a2c305728465d15eb7c9 (patch) | |
tree | 1dd98b7239f194e0db3102a0f05aacc1707a4f2c /ext/unicorn_http/common_field_optimization.h | |
parent | 2977d2c6dbb82fb62f2b6ba44687e44a554e2573 (diff) | |
download | unicorn-2a6cb76d5010cb763ef5a2c305728465d15eb7c9.tar.gz |
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/
Diffstat (limited to 'ext/unicorn_http/common_field_optimization.h')
-rw-r--r-- | ext/unicorn_http/common_field_optimization.h | 4 |
1 files changed, 2 insertions, 2 deletions
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); } } |