Skip to content

Commit dde21a7

Browse files
committed
Explicitly convert between VALUE and st_data_t
1 parent c5cf4d4 commit dde21a7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,9 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
844844
if (ar_cleared_entry(hash, i)) continue;
845845

846846
ar_table_pair *pair = RHASH_AR_TABLE_REF(hash, i);
847-
enum st_retval retval = (*func)(pair->key, pair->val, arg, 0);
847+
st_data_t key = (st_data_t)pair->key;
848+
st_data_t val = (st_data_t)pair->val;
849+
enum st_retval retval = (*func)(key, val, arg, 0);
848850
ensure_ar_table(hash);
849851
/* pair may be not valid here because of theap */
850852

@@ -856,14 +858,12 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
856858
return 0;
857859
case ST_REPLACE:
858860
if (replace) {
859-
VALUE key = pair->key;
860-
VALUE val = pair->val;
861861
retval = (*replace)(&key, &val, arg, TRUE);
862862

863863
// TODO: pair should be same as pair before.
864-
ar_table_pair *pair = RHASH_AR_TABLE_REF(hash, i);
865-
pair->key = key;
866-
pair->val = val;
864+
pair = RHASH_AR_TABLE_REF(hash, i);
865+
pair->key = (VALUE)key;
866+
pair->val = (VALUE)val;
867867
}
868868
break;
869869
case ST_DELETE:

0 commit comments

Comments
 (0)