summaryrefslogtreecommitdiff
path: root/ext/tk
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-10 14:52:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-10 14:52:19 +0000
commita73d958c33904fdabac95f49d9834779ca33c599 (patch)
tree18cde65b79b9002421da9848fcf35e4324a8ea67 /ext/tk
parentefae6194582001cb12108bc101d22dc1ed9a660c (diff)
* 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
Diffstat (limited to 'ext/tk')
-rw-r--r--ext/tk/tkutil/tkutil.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c
index 09ad7ce..956c673 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;