diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-21 04:47:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-21 04:47:01 +0000 |
commit | 271aaf297ec02e60f1b5e98b737e58e7cdf12eb7 (patch) | |
tree | d739fff49bee78a0c51bb361a429e36be7a79605 /hash.c | |
parent | be4fc7941bff50f6c90210a1d9e9178ffc05adda (diff) | |
download | ruby-271aaf297ec02e60f1b5e98b737e58e7cdf12eb7.tar.gz |
* hash.c (rb_hash_clear): use st_clear() unless iterating.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -842,7 +842,10 @@ rb_hash_clear(VALUE hash) { rb_hash_modify(hash); if (RHASH(hash)->tbl->num_entries > 0) { - rb_hash_foreach(hash, clear_i, 0); + if (RHASH(hash)->iter_lev > 0) + rb_hash_foreach(hash, clear_i, 0); + else + st_clear(RHASH(hash)->tbl); } return hash; |