mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Remove dead post-hoc rehash check
Hash#rehash checks whether the hash is iterating, and with VWA, RHASH_ST_TABLE() always returns the same thing for the same hash. RHASH_ST_TABLE(VALUE h) { return (st_table *)((uintptr_t)h + sizeof(struct RHash)); } So this check can never fail and raise an exception. Remove it.
This commit is contained in:
parent
bd27460c06
commit
b49ae45b88
1 changed files with 0 additions and 5 deletions
5
hash.c
5
hash.c
|
@ -1312,13 +1312,8 @@ hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp, int error)
|
||||||
|
|
||||||
if (error) return ST_STOP;
|
if (error) return ST_STOP;
|
||||||
|
|
||||||
st_table *tbl = RHASH_ST_TABLE(arg->hash);
|
|
||||||
int status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
|
int status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
|
||||||
|
|
||||||
if (RHASH_ST_TABLE(arg->hash) != tbl) {
|
|
||||||
rb_raise(rb_eRuntimeError, "rehash occurred during iteration");
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash_iter_status_check(status);
|
return hash_iter_status_check(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue