diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-25 21:34:35 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-25 21:34:35 +0000 |
commit | 48a2b96d2b8228a1c7dd49425fccd8b1202bf905 (patch) | |
tree | 2b584a1e13e292481269507051d79bf6358e3257 /io.c | |
parent | 5c094d381bca5d244495a7f4a94572c1f4562c28 (diff) | |
download | ruby-48a2b96d2b8228a1c7dd49425fccd8b1202bf905.tar.gz |
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
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -6725,8 +6725,7 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file) rb_io_taint_check(file); fptr = RFILE(file)->fptr; if (!fptr) { - fptr = RFILE(file)->fptr = ALLOC(rb_io_t); - MEMZERO(fptr, rb_io_t, 1); + fptr = RFILE(file)->fptr = ZALLOC(rb_io_t); } if (!NIL_P(nmode) || !NIL_P(opt)) { |