summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2023-03-09 15:50:58 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2023-03-22 12:50:42 -0700
commite055c0c7162d7d240c93227397cf3eca01ca86e7 (patch)
tree5c6e60e0238e905a9d47977bacf136f73a6f1a19 /shape.c
parent1a9e2d20e2c66933f8eb891a1ee85fae6015fcf1 (diff)
downloadruby-e055c0c7162d7d240c93227397cf3eca01ca86e7.tar.gz
Make shape functions static
These functions don't need to be in the header file, we can declare them as static.
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c83
1 files changed, 41 insertions, 42 deletions
diff --git a/shape.c b/shape.c
index cf1a4426eb..dbf8d908cf 100644
--- a/shape.c
+++ b/shape.c
@@ -113,6 +113,47 @@ rb_shape_get_shape(VALUE obj)
return rb_shape_get_shape_by_id(rb_shape_get_shape_id(obj));
}
+static rb_shape_t *
+shape_alloc(void)
+{
+ rb_vm_t *vm = GET_VM();
+ shape_id_t shape_id = vm->next_shape_id;
+ vm->next_shape_id++;
+
+ if (shape_id == MAX_SHAPE_ID) {
+ // TODO: Make an OutOfShapesError ??
+ rb_bug("Out of shapes\n");
+ }
+
+ return &GET_VM()->shape_list[shape_id];
+}
+
+static rb_shape_t *
+rb_shape_alloc_with_parent_id(ID edge_name, shape_id_t parent_id)
+{
+ rb_shape_t * shape = shape_alloc();
+
+ shape->edge_name = edge_name;
+ shape->next_iv_index = 0;
+ shape->parent_id = parent_id;
+
+ 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_t * shape = rb_shape_alloc_with_parent_id(edge_name, rb_shape_id(parent));
+ shape->size_pool_index = size_pool_index;
+ 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)
{
@@ -383,48 +424,6 @@ rb_shape_get_iv_index(rb_shape_t * shape, ID id, attr_index_t *value)
return false;
}
-static rb_shape_t *
-shape_alloc(void)
-{
- rb_vm_t *vm = GET_VM();
- shape_id_t shape_id = vm->next_shape_id;
- vm->next_shape_id++;
-
- if (shape_id == MAX_SHAPE_ID) {
- // TODO: Make an OutOfShapesError ??
- rb_bug("Out of shapes\n");
- }
-
- return &GET_VM()->shape_list[shape_id];
-}
-
-rb_shape_t *
-rb_shape_alloc_with_parent_id(ID edge_name, shape_id_t parent_id)
-{
- rb_shape_t * shape = shape_alloc();
-
- shape->edge_name = edge_name;
- shape->next_iv_index = 0;
- shape->parent_id = parent_id;
-
- return shape;
-}
-
-rb_shape_t *
-rb_shape_alloc_with_size_pool_index(ID edge_name, rb_shape_t * parent, uint8_t size_pool_index)
-{
- rb_shape_t * shape = rb_shape_alloc_with_parent_id(edge_name, rb_shape_id(parent));
- shape->size_pool_index = size_pool_index;
- return shape;
-}
-
-
-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);
-}
-
void
rb_shape_set_shape(VALUE obj, rb_shape_t* shape)
{