Skip to content

Commit af98946

Browse files
committed
Remove unnecessary freeing functions
`rbs_node_destroy`, `rbs_hash_free`, `rbs_node_list_free` are only calling each other recursively without any real freeing logic. This is the result of previous efforts to allocate all nodes on the arena. So we don't need these functions anymore.
1 parent da91a88 commit af98946

File tree

6 files changed

+63
-861
lines changed

6 files changed

+63
-861
lines changed

ext/rbs_extension/main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ static VALUE parse_type_try(VALUE a) {
125125

126126

127127
VALUE ruby_ast = rbs_struct_to_ruby_value(ctx, type);
128-
rbs_node_destroy((rbs_node_t *) type);
129128
return ruby_ast;
130129
}
131130

@@ -214,7 +213,6 @@ static VALUE parse_method_type_try(VALUE a) {
214213
);
215214

216215
VALUE ruby_ast = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) method_type);
217-
rbs_node_destroy((rbs_node_t *) method_type);
218216
return ruby_ast;
219217
}
220218

@@ -255,7 +253,6 @@ static VALUE parse_signature_try(VALUE a) {
255253
);
256254

257255
VALUE ruby_ast = rbs_struct_to_ruby_value(ctx, (rbs_node_t *) signature);
258-
rbs_node_destroy((rbs_node_t *) signature);
259256
return ruby_ast;
260257
}
261258

include/rbs/ast.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,4 @@ rbs_types_union_t *rbs_types_union_new(rbs_allocator_t *allocator, rbs_location_
685685
rbs_types_untyped_function_t *rbs_types_untyped_function_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_node_t *return_type);
686686
rbs_types_variable_t *rbs_types_variable_new(rbs_allocator_t *allocator, rbs_location_t *location, rbs_ast_symbol_t *name);
687687

688-
void rbs_node_destroy(rbs_node_t *any_node);
689-
690688
#endif

0 commit comments

Comments
 (0)