ruby-changes:57290
From: Aaron <ko1@a...>
Date: Tue, 27 Aug 2019 03:15:18 +0900 (JST)
Subject: [ruby-changes:57290] Aaron Patterson: d9bfbe363d (master): Make `gc_update_table_refs` match `mark_tbl_no_pin` a little more closely
https://git.ruby-lang.org/ruby.git/commit/?id=d9bfbe363d From d9bfbe363d14f8258d239eb702729926571b88e7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Mon, 26 Aug 2019 11:14:03 -0700 Subject: 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. diff --git a/gc.c b/gc.c index 0d7732a..f7b770b 100644 --- a/gc.c +++ b/gc.c @@ -7770,9 +7770,11 @@ hash_foreach_replace(st_data_t key, st_data_t value, st_data_t argp, int error) https://github.com/ruby/ruby/blob/trunk/gc.c#L7770 } 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"); } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/