summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--hash.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f33e36f27..fd4ffa4471 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-Sat Mar 31 07:44:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 31 07:47:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (st_foreach_safe): since table is not for VALUE, Qundef is
+ not special value, so use 0 instead. therefore this function can be
+ applied to only st_table which 0 is invalid as keys, e.g., IDs.
* hash.c: Qundef cannot be passed from st_foreach_check().
diff --git a/hash.c b/hash.c
index 328917862c..b036e8bf8a 100644
--- a/hash.c
+++ b/hash.c
@@ -131,7 +131,7 @@ st_foreach_safe(st_table *table, int (*func)(ANYARGS), st_data_t a)
arg.tbl = table;
arg.func = (st_foreach_func *)func;
arg.arg = a;
- if (st_foreach_check(table, foreach_safe_i, (st_data_t)&arg, (st_data_t)Qundef)) {
+ if (st_foreach_check(table, foreach_safe_i, (st_data_t)&arg, 0)) {
rb_raise(rb_eRuntimeError, "hash modified during iteration");
}
}