diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-04 04:51:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-10-04 04:51:08 +0000 |
commit | 758cb647c7ac9e02a9ee0d7cb0934a5c963481e0 (patch) | |
tree | a6ad21b14e176e9c3a39a775781b978950315543 /variable.c | |
parent | d426749ff0ec0348e8b2f9e32724ac715aad500b (diff) |
19991004
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/variable.c b/variable.c index 23ae945870..7b273933ac 100644 --- a/variable.c +++ b/variable.c @@ -916,7 +916,7 @@ VALUE rb_obj_instance_variables(obj) VALUE obj; { - VALUE ary; + VALUE ary = rb_ary_new(); if (!FL_TEST(obj, FL_TAINT) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't get metainfo"); @@ -924,24 +924,22 @@ rb_obj_instance_variables(obj) case T_OBJECT: case T_CLASS: case T_MODULE: - ary = rb_ary_new(); if (ROBJECT(obj)->iv_tbl) { st_foreach(ROBJECT(obj)->iv_tbl, ivar_i, ary); } - return ary; + break; default: - if (!generic_iv_tbl) return Qnil; + if (!generic_iv_tbl) break; if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) { st_table *tbl; if (st_lookup(generic_iv_tbl, obj, &tbl)) { - ary = rb_ary_new(); st_foreach(tbl, ivar_i, ary); - return ary; } } + break; } - return Qnil; + return ary; } VALUE |