summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-14 02:33:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-14 02:33:50 +0000
commitb0af0592fdd9e9d4e4b863fde006d67ccefeac21 (patch)
tree31806d2a972f2ad490dc87a6ceeda8974c6275ae /hash.c
parentaf5e21292c43e06ed072274d015239c79f0c33f7 (diff)
hash.c, st.c: fix for ST_CHECK
* hash.c (foreach_safe_i, hash_foreach_iter): deal with error detected by ST_CHECK. * st.c (st_foreach_check): call with non-error argument in normal case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index bcd087a..a37318b 100644
--- a/hash.c
+++ b/hash.c
@@ -141,10 +141,12 @@ struct foreach_safe_arg {
};
static int
-foreach_safe_i(st_data_t key, st_data_t value, struct foreach_safe_arg *arg)
+foreach_safe_i(st_data_t key, st_data_t value, st_data_t args, int error)
{
int status;
+ struct foreach_safe_arg *arg = (void *)args;
+ if (error) return ST_STOP;
status = (*arg->func)(key, value, arg->arg);
if (status == ST_CONTINUE) {
return ST_CHECK;
@@ -174,12 +176,13 @@ struct hash_foreach_arg {
};
static int
-hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp)
+hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp, int error)
{
struct hash_foreach_arg *arg = (struct hash_foreach_arg *)argp;
int status;
st_table *tbl;
+ if (error) return ST_STOP;
tbl = RHASH(arg->hash)->ntbl;
status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
if (RHASH(arg->hash)->ntbl != tbl) {