diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-17 23:56:37 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-17 23:56:37 +0000 |
commit | 05561ad75c4e3e7b1cb2615f51683aa8478e7540 (patch) | |
tree | f82f09b2949c458a47c05d889b3ca68dde200dd1 /ext | |
parent | df33c063fccf1bca9e7d67140b2950e1b434d9b4 (diff) | |
download | ruby-05561ad75c4e3e7b1cb2615f51683aa8478e7540.tar.gz |
ext/objspace/objspace.c: remove unneeded code clones.
`setup_hash` have already performed nil check and empty check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/objspace/objspace.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index ba138e6244..ee76367b44 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -203,7 +203,7 @@ type2sym(enum ruby_value_type i) * * Note that this information is incomplete. You need to deal with * this information as only a *HINT*. Especially, total size of - * T_DATA may not right size. + * T_DATA may be wrong. * * It returns a hash as: * {:TOTAL=>1461154, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249, ...} @@ -232,13 +232,6 @@ count_objects_size(int argc, VALUE *argv, VALUE os) rb_objspace_each_objects(cos_i, &counts[0]); - if (hash == Qnil) { - hash = rb_hash_new(); - } - else if (!RHASH_EMPTY_P(hash)) { - st_foreach(RHASH_TBL(hash), set_zero_i, hash); - } - for (i = 0; i <= T_MASK; i++) { if (counts[i]) { VALUE type = type2sym(i); @@ -313,13 +306,6 @@ count_symbols(int argc, VALUE *argv, VALUE os) size_t immortal_symbols = rb_sym_immortal_count(); rb_objspace_each_objects(cs_i, &dynamic_counts); - if (hash == Qnil) { - hash = rb_hash_new(); - } - else if (!RHASH_EMPTY_P(hash)) { - st_foreach(RHASH_TBL(hash), set_zero_i, hash); - } - rb_hash_aset(hash, ID2SYM(rb_intern("mortal_dynamic_symbol")), SIZET2NUM(dynamic_counts.mortal)); rb_hash_aset(hash, ID2SYM(rb_intern("immortal_dynamic_symbol")), SIZET2NUM(dynamic_counts.immortal)); rb_hash_aset(hash, ID2SYM(rb_intern("immortal_static_symbol")), SIZET2NUM(immortal_symbols - dynamic_counts.immortal)); @@ -380,13 +366,6 @@ count_nodes(int argc, VALUE *argv, VALUE os) rb_objspace_each_objects(cn_i, &nodes[0]); - if (hash == Qnil) { - hash = rb_hash_new(); - } - else if (!RHASH_EMPTY_P(hash)) { - st_foreach(RHASH_TBL(hash), set_zero_i, hash); - } - for (i=0; i<NODE_LAST; i++) { if (nodes[i] != 0) { VALUE node; |