diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2019-08-26 11:14:03 -0700 |
---|---|---|
committer | Aaron Patterson <tenderlove@ruby-lang.org> | 2019-08-26 11:14:03 -0700 |
commit | d9bfbe363d14f8258d239eb702729926571b88e7 (patch) | |
tree | b6f8182bcab36aaf42e5903054f6a43c92615788 | |
parent | 3a4a58e2ccf13be874cc81e9c663bd39e687acd3 (diff) | |
download | ruby-d9bfbe363d14f8258d239eb702729926571b88e7.tar.gz |
Make `gc_update_table_refs` match `mark_tbl_no_pin` a little more closely
This commit just makes `gc_update_table_refs` match `mark_tbl_no_pin`
more closely.
-rw-r--r-- | gc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -7770,9 +7770,11 @@ hash_foreach_replace(st_data_t key, st_data_t value, st_data_t argp, int error) } static void -gc_update_table_refs(rb_objspace_t * objspace, st_table *ht) +gc_update_table_refs(rb_objspace_t * objspace, st_table *tbl) { - if (st_foreach_with_replace(ht, hash_foreach_replace, hash_replace_ref, (st_data_t)objspace)) { + if (!tbl || tbl->num_entries == 0) return; + + if (st_foreach_with_replace(tbl, hash_foreach_replace, hash_replace_ref, (st_data_t)objspace)) { rb_raise(rb_eRuntimeError, "hash modified during iteration"); } } |