Skip to content

Commit

Permalink
Remove unused functions from struct rb_parser_config_struct
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Apr 15, 2024
1 parent f5d8926 commit ebaa87f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion node.c
Expand Up @@ -81,7 +81,6 @@ rb_node_buffer_new(void)
#define xfree ast->node_buffer->config->free
#define rb_xmalloc_mul_add ast->node_buffer->config->xmalloc_mul_add
#define ruby_xrealloc(var,size) (ast->node_buffer->config->realloc_n((void *)var, 1, size))
#define rb_gc_mark_and_move ast->node_buffer->config->gc_mark_and_move
#endif

typedef void node_itr_t(rb_ast_t *ast, void *ctx, NODE *node);
Expand Down
17 changes: 0 additions & 17 deletions ruby_parser.c
Expand Up @@ -309,18 +309,6 @@ syntax_error_new(void)
return rb_class_new_instance(0, 0, rb_eSyntaxError);
}

static VALUE
obj_write(VALUE old, VALUE *slot, VALUE young)
{
return RB_OBJ_WRITE(old, slot, young);
}

static VALUE
default_rs(void)
{
return rb_default_rs;
}

static void *
memmove2(void *dest, const void *src, size_t t, size_t n)
{
Expand Down Expand Up @@ -429,7 +417,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.ary_push = rb_ary_push,
.ary_new_from_args = rb_ary_new_from_args,
.ary_unshift = rb_ary_unshift,
.ary_modify = rb_ary_modify,
.array_len = rb_array_len,
.array_aref = RARRAY_AREF,

Expand Down Expand Up @@ -476,7 +463,6 @@ static const rb_parser_config_t rb_global_parser_config = {

.stderr_tty_p = rb_stderr_tty_p,
.write_error_str = rb_write_error_str,
.default_rs = default_rs,
.io_write = rb_io_write,
.io_flush = rb_io_flush,
.io_puts = rb_io_puts,
Expand All @@ -501,7 +487,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.enc_mbcput = enc_mbcput,
.enc_find_index = rb_enc_find_index,
.enc_from_index = enc_from_index,
.enc_associate_index = rb_enc_associate_index,
.enc_isspace = enc_isspace,
.enc_coderange_7bit = ENC_CODERANGE_7BIT,
.enc_coderange_unknown = ENC_CODERANGE_UNKNOWN,
Expand All @@ -528,10 +513,8 @@ static const rb_parser_config_t rb_global_parser_config = {

.sized_xfree = ruby_sized_xfree,
.sized_realloc_n = ruby_sized_realloc_n,
.obj_write = obj_write,
.gc_guard = gc_guard,
.gc_mark = rb_gc_mark,
.gc_mark_and_move = rb_gc_mark_and_move,

.reg_compile = rb_reg_compile,
.reg_check_preprocess = rb_reg_check_preprocess,
Expand Down
5 changes: 0 additions & 5 deletions rubyparser.h
Expand Up @@ -1264,7 +1264,6 @@ typedef struct rb_parser_config_struct {
VALUE (*ary_push)(VALUE ary, VALUE elem);
VALUE (*ary_new_from_args)(long n, ...);
VALUE (*ary_unshift)(VALUE ary, VALUE item);
void (*ary_modify)(VALUE ary);
long (*array_len)(VALUE a);
VALUE (*array_aref)(VALUE, long);

Expand Down Expand Up @@ -1318,7 +1317,6 @@ typedef struct rb_parser_config_struct {
/* IO */
int (*stderr_tty_p)(void);
void (*write_error_str)(VALUE mesg);
VALUE (*default_rs)(void);
VALUE (*io_write)(VALUE io, VALUE str);
VALUE (*io_flush)(VALUE io);
VALUE (*io_puts)(int argc, const VALUE *argv, VALUE out);
Expand All @@ -1345,7 +1343,6 @@ typedef struct rb_parser_config_struct {
int (*enc_mbcput)(unsigned int c, void *buf, rb_encoding *enc);
int (*enc_find_index)(const char *name);
rb_encoding *(*enc_from_index)(int idx);
VALUE (*enc_associate_index)(VALUE obj, int encindex);
int (*enc_isspace)(OnigCodePoint c, rb_encoding *enc);
rb_encoding *(*enc_compatible)(VALUE str1, VALUE str2);
VALUE (*enc_from_encoding)(rb_encoding *enc);
Expand Down Expand Up @@ -1378,10 +1375,8 @@ typedef struct rb_parser_config_struct {
/* GC */
void (*sized_xfree)(void *x, size_t size);
void *(*sized_realloc_n)(void *ptr, size_t new_count, size_t element_size, size_t old_count);
VALUE (*obj_write)(VALUE, VALUE *, VALUE);
void (*gc_guard)(VALUE);
void (*gc_mark)(VALUE);
void (*gc_mark_and_move)(VALUE *ptr);

/* Re */
VALUE (*reg_compile)(VALUE str, int options, const char *sourcefile, int sourceline);
Expand Down
5 changes: 0 additions & 5 deletions universal_parser.c
Expand Up @@ -95,7 +95,6 @@
#undef rb_ary_new_from_args
#define rb_ary_new_from_args p->config->ary_new_from_args
#define rb_ary_unshift p->config->ary_unshift
#define rb_ary_modify p->config->ary_modify
#undef RARRAY_LEN
#define RARRAY_LEN p->config->array_len
#define RARRAY_AREF p->config->array_aref
Expand Down Expand Up @@ -154,7 +153,6 @@

#define rb_stderr_tty_p p->config->stderr_tty_p
#define rb_write_error_str p->config->write_error_str
#define rb_default_rs p->config->default_rs()
#define rb_io_write p->config->io_write
#define rb_io_flush p->config->io_flush
#define rb_io_puts p->config->io_puts
Expand All @@ -179,7 +177,6 @@
#define rb_enc_mbcput p->config->enc_mbcput
#define rb_enc_find_index p->config->enc_find_index
#define rb_enc_from_index p->config->enc_from_index
#define rb_enc_associate_index p->config->enc_associate_index
#define rb_enc_isspace p->config->enc_isspace
#define ENC_CODERANGE_7BIT p->config->enc_coderange_7bit
#define ENC_CODERANGE_UNKNOWN p->config->enc_coderange_unknown
Expand All @@ -202,8 +199,6 @@

#define ruby_sized_xfree p->config->sized_xfree
#define SIZED_REALLOC_N(v, T, m, n) ((v) = (T *)p->config->sized_realloc_n((void *)(v), (m), sizeof(T), (n)))
#undef RB_OBJ_WRITE
#define RB_OBJ_WRITE(old, slot, young) p->config->obj_write((VALUE)(old), (VALUE *)(slot), (VALUE)(young))
#undef RB_GC_GUARD
#define RB_GC_GUARD p->config->gc_guard
#define rb_gc_mark p->config->gc_mark
Expand Down

0 comments on commit ebaa87f

Please sign in to comment.