From a73d958c33904fdabac95f49d9834779ca33c599 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 10 Mar 2012 14:52:19 +0000 Subject: * st.c: add st_foreach_check for fixing iteration over packed table and st_delete_safe. patched by Sokolov Yura at https://github.com/ruby/ruby/pull/84 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/tkutil/tkutil.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'ext/tk/tkutil') diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c index 09ad7ce143..956c6737c9 100644 --- a/ext/tk/tkutil/tkutil.c +++ b/ext/tk/tkutil/tkutil.c @@ -266,7 +266,6 @@ to_strkey(key, value, hash) VALUE value; VALUE hash; { - if (key == Qundef) return ST_CONTINUE; rb_hash_aset(hash, rb_funcall(key, ID_to_s, 0, 0), value); return ST_CHECK; } @@ -280,7 +279,7 @@ tk_symbolkey2str(self, keys) if NIL_P(keys) return new_keys; keys = rb_convert_type(keys, T_HASH, "Hash", "to_hash"); - st_foreach(RHASH_TBL(keys), to_strkey, new_keys); + st_foreach_check(RHASH_TBL(keys), to_strkey, new_keys, Qundef); return new_keys; } @@ -653,7 +652,6 @@ push_kv(key, val, args) ary = RARRAY_PTR(args)[0]; - if (key == Qundef) return ST_CONTINUE; #if 0 rb_ary_push(ary, key2keyname(key)); if (val != TK_None) rb_ary_push(ary, val); @@ -676,7 +674,7 @@ hash2kv(hash, ary, self) volatile VALUE dst = rb_ary_new2(2 * RHASH_SIZE(hash)); volatile VALUE args = rb_ary_new3(2, dst, self); - st_foreach(RHASH_TBL(hash), push_kv, args); + st_foreach_check(RHASH_TBL(hash), push_kv, args, Qundef); if (NIL_P(ary)) { return dst; @@ -695,7 +693,6 @@ push_kv_enc(key, val, args) ary = RARRAY_PTR(args)[0]; - if (key == Qundef) return ST_CONTINUE; #if 0 rb_ary_push(ary, key2keyname(key)); if (val != TK_None) { @@ -721,7 +718,7 @@ hash2kv_enc(hash, ary, self) volatile VALUE dst = rb_ary_new2(2 * RHASH_SIZE(hash)); volatile VALUE args = rb_ary_new3(2, dst, self); - st_foreach(RHASH_TBL(hash), push_kv_enc, args); + st_foreach_check(RHASH_TBL(hash), push_kv_enc, args, Qundef); if (NIL_P(ary)) { return dst; -- cgit v1.2.3