mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Explicitly convert between VALUE and st_data_t
This commit is contained in:
parent
c5cf4d4e12
commit
dde21a7967
12
hash.c
12
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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user