Skip to content

Commit

Permalink
Use rb_hash_foreach in objspace.c
Browse files Browse the repository at this point in the history
Using RHASH_TBL_RAW is a private API, so we should use rb_hash_foreach
rather than RHASH_TBL_RAW with st_foreach.
  • Loading branch information
peterzhu2118 committed Feb 23, 2024
1 parent 6bd3e8f commit 386a006
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ext/objspace/objspace.c
Expand Up @@ -169,8 +169,7 @@ setup_hash(int argc, VALUE *argv)
hash = rb_hash_new();
}
else if (!RHASH_EMPTY_P(hash)) {
/* WB: no new reference */
st_foreach(RHASH_TBL_RAW(hash), set_zero_i, hash);
rb_hash_foreach(hash, set_zero_i, (st_data_t)hash);
}

return hash;
Expand Down

0 comments on commit 386a006

Please sign in to comment.