diff options
author | Jean Boussier <[email protected]> | 2025-05-08 17:38:39 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2025-05-09 10:22:51 +0200 |
commit | 7116b0a7f1398f18346ad6f9ba805e3877d45944 (patch) | |
tree | 32110f3153bcd01121b5c437ff9a87f7889f3ee8 /shape.c | |
parent | 30ef0f180b396314521d1309e7732ce921cd2fab (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.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 |