diff options
author | yui-knk <spiketeika@gmail.com> | 2024-04-28 12:45:30 +0900 |
---|---|---|
committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2024-04-28 17:58:57 +0900 |
commit | 29aaf4abe61e5ce24577eb3e8ccaa0a21934bb30 (patch) | |
tree | 312353a551fbf92f33b85c6a354ae7dbfa6cdcad | |
parent | 5c3d5c7cddb7ecd4c8b776492a232abafbaae0e6 (diff) |
Remove `ast_new` field from `struct rb_parser_config_struct`
`ast_new` can be embedded into `rb_ast_new`.
-rw-r--r-- | node.c | 3 | ||||
-rw-r--r-- | ruby_parser.c | 10 | ||||
-rw-r--r-- | rubyparser.h | 2 |
3 files changed, 2 insertions, 13 deletions
@@ -301,8 +301,9 @@ rb_ast_t * rb_ast_new(const rb_parser_config_t *config) { node_buffer_t *nb = rb_node_buffer_new(config); - rb_ast_t *ast = config->ast_new(nb); + rb_ast_t *ast = (rb_ast_t *)config->calloc(1, sizeof(rb_ast_t)); ast->config = config; + ast->node_buffer = nb; return ast; } #else diff --git a/ruby_parser.c b/ruby_parser.c index 40b7e18aca..d8b7580e00 100644 --- a/ruby_parser.c +++ b/ruby_parser.c @@ -292,14 +292,6 @@ arg_error(void) return rb_eArgError; } -static rb_ast_t * -ast_new(node_buffer_t *nb) -{ - rb_ast_t *ast = ruby_xcalloc(1, sizeof(rb_ast_t)); - ast->node_buffer = nb; - return ast; -} - static VALUE static_id2sym(ID id) { @@ -348,8 +340,6 @@ static const rb_parser_config_t rb_global_parser_config = { .nonempty_memcpy = nonempty_memcpy, .xmalloc_mul_add = rb_xmalloc_mul_add, - .ast_new = ast_new, - .compile_callback = rb_suppress_tracing, .reg_named_capture_assign = reg_named_capture_assign, diff --git a/rubyparser.h b/rubyparser.h index 813ad321e2..7e85febd99 100644 --- a/rubyparser.h +++ b/rubyparser.h @@ -1255,8 +1255,6 @@ typedef struct rb_parser_config_struct { void *(*nonempty_memcpy)(void *dest, const void *src, size_t t, size_t n); void *(*xmalloc_mul_add)(size_t x, size_t y, size_t z); - rb_ast_t *(*ast_new)(node_buffer_t *nb); - // VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg); VALUE (*compile_callback)(VALUE (*func)(VALUE), VALUE arg); NODE *(*reg_named_capture_assign)(struct parser_params* p, VALUE regexp, const rb_code_location_t *loc); |