summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-05-08 17:38:39 +0200
committerJean Boussier <[email protected]>2025-05-09 10:22:51 +0200
commit7116b0a7f1398f18346ad6f9ba805e3877d45944 (patch)
tree32110f3153bcd01121b5c437ff9a87f7889f3ee8 /shape.c
parent30ef0f180b396314521d1309e7732ce921cd2fab (diff)
Extract `rb_shape_free_all`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13283
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/shape.c b/shape.c
index 16eb5b50f4..ab32533a9d 100644
--- a/shape.c
+++ b/shape.c
@@ -1432,6 +1432,21 @@ Init_default_shapes(void)
}
void
+rb_shape_free_all(void)
+{
+ rb_shape_t *cursor = rb_shape_get_root_shape();
+ rb_shape_t *end = rb_shape_get_shape_by_id(GET_SHAPE_TREE()->next_shape_id);
+ while (cursor < end) {
+ if (cursor->edges && !SINGLE_CHILD_P(cursor->edges)) {
+ rb_id_table_free(cursor->edges);
+ }
+ cursor++;
+ }
+
+ xfree(GET_SHAPE_TREE());
+}
+
+void
Init_shape(void)
{
#if SHAPE_DEBUG