summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2023-09-24 09:07:34 -0400
committerPeter Zhu <[email protected]>2023-09-24 09:07:34 -0400
commit36cdf163dfbcac5b0e7fedbd55c817b5d5c971fb (patch)
tree558ecfc0a398e4e906fd4402065d21ea7be3e67a /hash.c
parent34d802f32f00df1ac0220b62f72605827c16bad8 (diff)
Add hash_st_free
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index dd6429b6c0..8e0295c38e 100644
--- a/hash.c
+++ b/hash.c
@@ -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);
}