diff options
author | Peter Zhu <[email protected]> | 2023-09-24 09:07:34 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-09-24 09:07:34 -0400 |
commit | 36cdf163dfbcac5b0e7fedbd55c817b5d5c971fb (patch) | |
tree | 558ecfc0a398e4e906fd4402065d21ea7be3e67a /hash.c | |
parent | 34d802f32f00df1ac0220b62f72605827c16bad8 (diff) |
Add hash_st_free
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1160,7 +1160,7 @@ ar_clear(VALUE hash) } static void -hash_st_free_and_clear_table(VALUE hash) +hash_st_free(VALUE hash) { HASH_ASSERT(RHASH_ST_TABLE_P(hash)); @@ -1168,6 +1168,12 @@ hash_st_free_and_clear_table(VALUE hash) free(tab->bins); free(tab->entries); +} + +static void +hash_st_free_and_clear_table(VALUE hash) +{ + hash_st_free(hash); RHASH_ST_CLEAR(hash); } @@ -1974,7 +1980,7 @@ rb_hash_rehash(VALUE hash) rb_hash_foreach(hash, rb_hash_rehash_i, (VALUE)tmp); - hash_st_free_and_clear_table(hash); + hash_st_free(hash); RHASH_ST_TABLE_SET(hash, tbl); RHASH_ST_CLEAR(tmp); } |