mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Avoid second RHASH_AR_TABLE_REF lookup
This commit is contained in:
parent
900eb04853
commit
abc8745fc3
1 changed files with 3 additions and 2 deletions
5
hash.c
5
hash.c
|
@ -882,8 +882,9 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
|
|||
if (replace) {
|
||||
(*replace)(&key, &val, arg, TRUE);
|
||||
|
||||
// TODO: pair should be same as pair before.
|
||||
pair = RHASH_AR_TABLE_REF(hash, i);
|
||||
// Pair should not have moved
|
||||
HASH_ASSERT(pair == RHASH_AR_TABLE_REF(hash, i));
|
||||
|
||||
pair->key = (VALUE)key;
|
||||
pair->val = (VALUE)val;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue