summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-01-14 23:44:18 +0900
committerNobuyoshi Nakada <[email protected]>2024-01-15 09:35:46 +0900
commitdde21a7967960e24377b01941cea6c30c17fa01d (patch)
tree2b47b963f8164596dbc3d52225555f2a5e1008ec /hash.c
parentc5cf4d4e129f64cb69aaf0a829aed068ef1943c4 (diff)
Explicitly convert between `VALUE` and `st_data_t`
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hash.c b/hash.c
index 6a23f16957..91f1e73a39 100644
--- a/hash.c
+++ b/hash.c
@@ -844,7 +844,9 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
if (ar_cleared_entry(hash, i)) continue;
ar_table_pair *pair = RHASH_AR_TABLE_REF(hash, i);
- enum st_retval retval = (*func)(pair->key, pair->val, arg, 0);
+ st_data_t key = (st_data_t)pair->key;
+ st_data_t val = (st_data_t)pair->val;
+ enum st_retval retval = (*func)(key, val, arg, 0);
ensure_ar_table(hash);
/* pair may be not valid here because of theap */
@@ -856,14 +858,12 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
return 0;
case ST_REPLACE:
if (replace) {
- VALUE key = pair->key;
- VALUE val = pair->val;
retval = (*replace)(&key, &val, arg, TRUE);
// TODO: pair should be same as pair before.
- ar_table_pair *pair = RHASH_AR_TABLE_REF(hash, i);
- pair->key = key;
- pair->val = val;
+ pair = RHASH_AR_TABLE_REF(hash, i);
+ pair->key = (VALUE)key;
+ pair->val = (VALUE)val;
}
break;
case ST_DELETE: