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 5, 2024
1 parent 58d03c3 commit bd728a6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 66 deletions.
2 changes: 0 additions & 2 deletions parse.y
Expand Up @@ -82,8 +82,6 @@ static NODE *reg_named_capture_assign(struct parser_params* p, VALUE regexp, con

#define compile_callback rb_suppress_tracing
VALUE rb_io_gets_internal(VALUE io);

VALUE rb_node_case_when_optimizable_literal(const NODE *const node);
#endif /* !UNIVERSAL_PARSER */

#ifndef RIPPER
Expand Down
30 changes: 0 additions & 30 deletions ruby_parser.c
Expand Up @@ -327,12 +327,6 @@ obj_write(VALUE old, VALUE *slot, VALUE young)
return RB_OBJ_WRITE(old, slot, young);
}

static VALUE
obj_written(VALUE old, VALUE slot, VALUE young)
{
return RB_OBJ_WRITTEN(old, slot, young);
}

static VALUE
default_rs(void)
{
Expand Down Expand Up @@ -393,12 +387,6 @@ arg_error(void)
return rb_eArgError;
}

static VALUE
ruby_vm_frozen_core(void)
{
return rb_mRubyVMFrozenCore;
}

static rb_ast_t *
ast_new(VALUE nb)
{
Expand Down Expand Up @@ -440,8 +428,6 @@ enc_mbc_to_codepoint(const char *p, const char *e, void *enc)

VALUE rb_io_gets_internal(VALUE io);
extern VALUE rb_eArgError;
extern VALUE rb_mRubyVMFrozenCore;
VALUE rb_node_case_when_optimizable_literal(const NODE *const node);

static const rb_parser_config_t rb_global_parser_config = {
.malloc = ruby_xmalloc,
Expand All @@ -461,10 +447,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.compile_callback = rb_suppress_tracing,
.reg_named_capture_assign = reg_named_capture_assign,

.obj_freeze = rb_obj_freeze,
.obj_hide = rb_obj_hide,
.obj_freeze_raw = OBJ_FREEZE_RAW,

.fixnum_p = fixnum_p,
.symbol_p = symbol_p,

Expand Down Expand Up @@ -523,13 +505,6 @@ static const rb_parser_config_t rb_global_parser_config = {
.filesystem_str_new_cstr = rb_filesystem_str_new_cstr,
.obj_as_string = rb_obj_as_string,

.hash_clear = rb_hash_clear,
.hash_new = rb_hash_new,
.hash_aset = rb_hash_aset,
.hash_delete = rb_hash_delete,
.hash_lookup = rb_hash_lookup,
.ident_hash_new = rb_ident_hash_new,

.num2int = rb_num2int_inline,
.int2num = rb_int2num_inline,

Expand Down Expand Up @@ -588,11 +563,9 @@ 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,
.obj_written = obj_written,
.gc_guard = gc_guard,
.gc_mark = rb_gc_mark,
.gc_mark_and_move = rb_gc_mark_and_move,
.gc_location = rb_gc_location,

.reg_compile = rb_reg_compile,
.reg_check_preprocess = rb_reg_check_preprocess,
Expand Down Expand Up @@ -621,11 +594,8 @@ static const rb_parser_config_t rb_global_parser_config = {
.qfalse = Qfalse,
.qundef = Qundef,
.eArgError = arg_error,
.mRubyVMFrozenCore = ruby_vm_frozen_core,
.long2int = rb_long2int,

.node_case_when_optimizable_literal = rb_node_case_when_optimizable_literal,

/* For Ripper */
.static_id2sym = static_id2sym,
.str_coderange_scan_restartable = str_coderange_scan_restartable,
Expand Down
18 changes: 0 additions & 18 deletions rubyparser.h
Expand Up @@ -1248,11 +1248,6 @@ typedef struct rb_parser_config_struct {
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);

/* Object */
VALUE (*obj_freeze)(VALUE obj);
VALUE (*obj_hide)(VALUE obj);
void (*obj_freeze_raw)(VALUE obj);

int (*fixnum_p)(VALUE);
int (*symbol_p)(VALUE);

Expand Down Expand Up @@ -1318,14 +1313,6 @@ typedef struct rb_parser_config_struct {
VALUE (*filesystem_str_new_cstr)(const char *ptr);
VALUE (*obj_as_string)(VALUE);

/* Hash */
VALUE (*hash_clear)(VALUE hash);
VALUE (*hash_new)(void);
VALUE (*hash_aset)(VALUE hash, VALUE key, VALUE val);
VALUE (*hash_delete)(VALUE hash, VALUE key);
VALUE (*hash_lookup)(VALUE hash, VALUE key);
VALUE (*ident_hash_new)(void);

/* Numeric */
int (*num2int)(VALUE val);
VALUE (*int2num)(int v);
Expand Down Expand Up @@ -1394,11 +1381,9 @@ typedef struct rb_parser_config_struct {
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);
VALUE (*obj_written)(VALUE, VALUE, VALUE);
void (*gc_guard)(VALUE);
void (*gc_mark)(VALUE);
void (*gc_mark_and_move)(VALUE *ptr);
VALUE (*gc_location)(VALUE value);

/* Re */
VALUE (*reg_compile)(VALUE str, int options, const char *sourcefile, int sourceline);
Expand Down Expand Up @@ -1432,11 +1417,8 @@ typedef struct rb_parser_config_struct {
VALUE qfalse;
VALUE qundef;
VALUE (*eArgError)(void);
VALUE (*mRubyVMFrozenCore)(void);
int (*long2int)(long);

VALUE (*node_case_when_optimizable_literal)(const NODE *const node);

/* For Ripper */
int enc_coderange_7bit;
int enc_coderange_unknown;
Expand Down
16 changes: 0 additions & 16 deletions universal_parser.c
Expand Up @@ -88,11 +88,6 @@
#define compile_callback p->config->compile_callback
#define reg_named_capture_assign p->config->reg_named_capture_assign

#define rb_obj_freeze p->config->obj_freeze
#define rb_obj_hide p->config->obj_hide
#undef OBJ_FREEZE_RAW
#define OBJ_FREEZE_RAW p->config->obj_freeze_raw

#undef FIXNUM_P
#define FIXNUM_P p->config->fixnum_p
#undef SYMBOL_P
Expand Down Expand Up @@ -167,12 +162,6 @@
#define rb_filesystem_str_new_cstr p->config->filesystem_str_new_cstr
#define rb_obj_as_string p->config->obj_as_string

#define rb_hash_clear p->config->hash_clear
#define rb_hash_new p->config->hash_new
#define rb_hash_aset p->config->hash_aset
#define rb_hash_lookup p->config->hash_lookup
#define rb_ident_hash_new p->config->ident_hash_new

#undef NUM2INT
#define NUM2INT p->config->num2int
#undef INT2NUM
Expand Down Expand Up @@ -230,8 +219,6 @@
#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_OBJ_WRITTEN
#define RB_OBJ_WRITTEN(old, oldv, young) p->config->obj_written((VALUE)(old), (VALUE)(oldv), (VALUE)(young))
#undef RB_GC_GUARD
#define RB_GC_GUARD p->config->gc_guard
#define rb_gc_mark p->config->gc_mark
Expand Down Expand Up @@ -273,15 +260,12 @@
#undef Qundef
#define Qundef p->config->qundef
#define rb_eArgError p->config->eArgError()
#define rb_mRubyVMFrozenCore p->config->mRubyVMFrozenCore()
#undef rb_long2int
#define rb_long2int p->config->long2int
#define rb_enc_mbminlen p->config->enc_mbminlen
#define rb_enc_isascii p->config->enc_isascii
#define rb_enc_mbc_to_codepoint p->config->enc_mbc_to_codepoint

#define rb_node_case_when_optimizable_literal p->config->node_case_when_optimizable_literal

#undef st_init_table_with_size
#define st_init_table_with_size rb_parser_st_init_table_with_size

Expand Down

0 comments on commit bd728a6

Please sign in to comment.