Skip to content

Commit 5b1aff3

Browse files
committed
Assert AR table entry stability on replace
1 parent 328e302 commit 5b1aff3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hash.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,10 +880,11 @@ ar_general_foreach(VALUE hash, st_foreach_check_callback_func *func, st_update_c
880880
return 0;
881881
case ST_REPLACE:
882882
if (replace) {
883+
ar_table_pair *orig_pair = pair;
883884
(*replace)(&key, &val, arg, TRUE);
884885

885-
// TODO: pair should be same as pair before.
886886
pair = RHASH_AR_TABLE_REF(hash, i);
887+
HASH_ASSERT(orig_pair == pair);
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