Skip to content

Commit 08eaa81

Browse files
committed
Sync gc/gc.h
1 parent 8e0b625 commit 08eaa81

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

gc/gc.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ hash_foreach_replace(st_data_t key, st_data_t value, st_data_t argp, int error)
219219
static int
220220
hash_replace_ref(st_data_t *key, st_data_t *value, st_data_t argp, int existing)
221221
{
222-
if (rb_gc_location((VALUE)*key) != (VALUE)*key) {
223-
*key = rb_gc_location((VALUE)*key);
222+
VALUE new_key = rb_gc_location((VALUE)*key);
223+
if (new_key != (VALUE)*key) {
224+
*key = new_key;
224225
}
225226

226-
if (rb_gc_location((VALUE)*value) != (VALUE)*value) {
227-
*value = rb_gc_location((VALUE)*value);
227+
VALUE new_value = rb_gc_location((VALUE)*value);
228+
if (new_value != (VALUE)*value) {
229+
*value = new_value;
228230
}
229231

230232
return ST_CONTINUE;

0 commit comments

Comments
 (0)