diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-25 13:38:53 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-25 13:38:53 +0000 |
commit | 09ea07e02c96135ed58831ce4216db82e4233c43 (patch) | |
tree | af14c5853bae480e18e34f71a16a025e5d315668 /gc.c | |
parent | 8a67b59c317a83eb46674d9510faa52823fa5ced (diff) |
Refactoring by adding `rb_imemo_alloc_new` to create imemo_alloc buffer
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -8110,20 +8110,25 @@ ruby_mimfree(void *ptr) free(mem); } +rb_imemo_alloc_t * +rb_imemo_alloc_new(VALUE v1, VALUE v2, VALUE v3, VALUE v0) +{ + VALUE s = rb_imemo_new(imemo_alloc, v1, v2, v3, v0); + rb_gc_writebarrier_unprotect(s); + return (rb_imemo_alloc_t *)s; +} + void * rb_alloc_tmp_buffer_with_count(volatile VALUE *store, size_t size, size_t cnt) { - VALUE s; - rb_imemo_alloc_t *a; + rb_imemo_alloc_t *s; void *ptr; - s = rb_imemo_new(imemo_alloc, 0, 0, 0, 0); - rb_gc_writebarrier_unprotect(s); + s = rb_imemo_alloc_new(0, 0, 0, 0); ptr = ruby_xmalloc0(size); - a = (rb_imemo_alloc_t*)s; - a->ptr = (VALUE*)ptr; - a->cnt = cnt; - *store = s; + s->ptr = (VALUE*)ptr; + s->cnt = cnt; + *store = (VALUE)s; return ptr; } |