diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2023-03-22 08:47:29 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2023-03-22 12:50:42 -0700 |
commit | 999ccb2b6b244e8a128ce8ff32665f83e2da535f (patch) | |
tree | ee9e4c3f403b70e005069561b7c43389f1954e56 /shape.c | |
parent | e055c0c7162d7d240c93227397cf3eca01ca86e7 (diff) | |
download | ruby-999ccb2b6b244e8a128ce8ff32665f83e2da535f.tar.gz |
combine allocation functions
Diffstat (limited to 'shape.c')
-rw-r--r-- | shape.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -136,24 +136,21 @@ rb_shape_alloc_with_parent_id(ID edge_name, shape_id_t parent_id) shape->edge_name = edge_name; shape->next_iv_index = 0; shape->parent_id = parent_id; + shape->edges = NULL; return shape; } static rb_shape_t * -rb_shape_alloc_with_size_pool_index(ID edge_name, rb_shape_t * parent, uint8_t size_pool_index) +rb_shape_alloc(ID edge_name, rb_shape_t * parent, enum shape_type type) { rb_shape_t * shape = rb_shape_alloc_with_parent_id(edge_name, rb_shape_id(parent)); - shape->size_pool_index = size_pool_index; + shape->type = (uint8_t)type; + shape->size_pool_index = parent->size_pool_index; + shape->capacity = parent->capacity; return shape; } -static rb_shape_t * -rb_shape_alloc(ID edge_name, rb_shape_t * parent) -{ - return rb_shape_alloc_with_size_pool_index(edge_name, parent, parent->size_pool_index); -} - static rb_shape_t* get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, bool * variation_created, bool new_shapes_allowed, bool new_shape_necessary) { @@ -182,11 +179,7 @@ get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, b else { *variation_created = had_edges; - rb_shape_t * new_shape = rb_shape_alloc(id, shape); - - new_shape->type = (uint8_t)shape_type; - new_shape->capacity = shape->capacity; - new_shape->edges = NULL; + rb_shape_t * new_shape = rb_shape_alloc(id, shape, shape_type); switch (shape_type) { case SHAPE_IVAR: |