Skip to content

Commit 78771c7

Browse files
committed
Avoid second RHASH_AR_TABLE_REF lookup
1 parent 68af192 commit 78771c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hash.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,9 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
882882
if (replace) {
883883
(*replace)(&key, &val, arg, TRUE);
884884

885-
// TODO: pair should be same as pair before.
886-
pair = RHASH_AR_TABLE_REF(hash, i);
885+
// Pair should not have moved
886+
HASH_ASSERT(pair == RHASH_AR_TABLE_REF(hash, i));
887+
887888
pair->key = (VALUE)key;
888889
pair->val = (VALUE)val;
889890
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy