From 48a2b96d2b8228a1c7dd49425fccd8b1202bf905 Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 25 Jul 2014 21:34:35 +0000 Subject: introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use Using calloc where possible reduces code and binary sizes. * include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement (Data_Make_Struct, TypedData_Make_Struct): ZALLOC replaces ALLOC+memset * compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO * cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO * io.c (rb_io_reopen): ditto * iseq.c (prepare_iseq_build): ditto * parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto * re.c (match_alloc): ditto * variable.c (rb_const_set): ditto * ext/socket/raddrinfo.c (get_addrinfo): ditto * ext/strscan/strscan.c (strscan_s_allocate): ditto * gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- cont.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cont.c') diff --git a/cont.c b/cont.c index 3df3aea22c..18a3373de2 100644 --- a/cont.c +++ b/cont.c @@ -1162,8 +1162,7 @@ fiber_t_alloc(VALUE fibval) } THREAD_MUST_BE_RUNNING(th); - fib = ALLOC(rb_fiber_t); - memset(fib, 0, sizeof(rb_fiber_t)); + fib = ZALLOC(rb_fiber_t); fib->cont.self = fibval; fib->cont.type = FIBER_CONTEXT; cont_init(&fib->cont, th); -- cgit v1.2.3