summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--hash.c11
2 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d0ac7b..f77c08c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu May 13 14:23:45 2004 WATANABE Hirofumi <eban@ruby-lang.org>
+
+ * hash.c (delete_if_i): use st_delete_safe() (via
+ rb_hash_delete()) instead of returning ST_DELETE.
+ backport from HEAD. [ruby-dev:23487]
+
Thu May 13 13:01:30 2004 akira yamada <akira@ruby-lang.org>
* lib/uri/mailto.rb (URI::MailTo::to_s): should include fragment.
diff --git a/hash.c b/hash.c
index 9d1c5d0..209fe26 100644
--- a/hash.c
+++ b/hash.c
@@ -679,12 +679,13 @@ rb_hash_shift(hash)
}
static enum st_retval
-delete_if_i(key, value)
- VALUE key, value;
+delete_if_i(key, value, hash)
+ VALUE key, value, hash;
{
if (key == Qundef) return ST_CONTINUE;
- if (RTEST(rb_yield_values(2, key, value)))
- return ST_DELETE;
+ if (RTEST(rb_yield_values(2, key, value))) {
+ rb_hash_delete(hash, key);
+ }
return ST_CONTINUE;
}
@@ -705,7 +706,7 @@ rb_hash_delete_if(hash)
VALUE hash;
{
rb_hash_modify(hash);
- rb_hash_foreach(hash, delete_if_i, 0);
+ rb_hash_foreach(hash, delete_if_i, hash);
return hash;
}