Constify rb_global_parser_config
This commit is contained in:
parent
4e5754a459
commit
0610f555ea
4
node.c
4
node.c
@ -53,7 +53,7 @@ init_node_buffer_list(node_buffer_list_t * nb, node_buffer_elem_t *head, void *x
|
|||||||
|
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
static node_buffer_t *
|
static node_buffer_t *
|
||||||
rb_node_buffer_new(rb_parser_config_t *config)
|
rb_node_buffer_new(const rb_parser_config_t *config)
|
||||||
#else
|
#else
|
||||||
static node_buffer_t *
|
static node_buffer_t *
|
||||||
rb_node_buffer_new(void)
|
rb_node_buffer_new(void)
|
||||||
@ -318,7 +318,7 @@ rb_ast_delete_node(rb_ast_t *ast, NODE *n)
|
|||||||
|
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
rb_ast_t *
|
rb_ast_t *
|
||||||
rb_ast_new(rb_parser_config_t *config)
|
rb_ast_new(const rb_parser_config_t *config)
|
||||||
{
|
{
|
||||||
node_buffer_t *nb = rb_node_buffer_new(config);
|
node_buffer_t *nb = rb_node_buffer_new(config);
|
||||||
return config->ast_new((VALUE)nb);
|
return config->ast_new((VALUE)nb);
|
||||||
|
4
node.h
4
node.h
@ -43,14 +43,14 @@ struct node_buffer_struct {
|
|||||||
// Array, whose entry is array
|
// Array, whose entry is array
|
||||||
VALUE tokens;
|
VALUE tokens;
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
rb_parser_config_t *config;
|
const rb_parser_config_t *config;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
RUBY_SYMBOL_EXPORT_BEGIN
|
RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
|
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
rb_ast_t *rb_ast_new(rb_parser_config_t *config);
|
rb_ast_t *rb_ast_new(const rb_parser_config_t *config);
|
||||||
#else
|
#else
|
||||||
rb_ast_t *rb_ast_new(void);
|
rb_ast_t *rb_ast_new(void);
|
||||||
#endif
|
#endif
|
||||||
|
6
parse.y
6
parse.y
@ -611,7 +611,7 @@ struct parser_params {
|
|||||||
struct lex_context ctxt;
|
struct lex_context ctxt;
|
||||||
|
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
rb_parser_config_t *config;
|
const rb_parser_config_t *config;
|
||||||
#endif
|
#endif
|
||||||
/* compile_option */
|
/* compile_option */
|
||||||
signed int frozen_string_literal:2; /* -1: not specified, 0: false, 1: true */
|
signed int frozen_string_literal:2; /* -1: not specified, 0: false, 1: true */
|
||||||
@ -15989,7 +15989,7 @@ rb_reserved_word(const char *str, unsigned int len)
|
|||||||
|
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
rb_parser_t *
|
rb_parser_t *
|
||||||
rb_ruby_parser_allocate(rb_parser_config_t *config)
|
rb_ruby_parser_allocate(const rb_parser_config_t *config)
|
||||||
{
|
{
|
||||||
/* parser_initialize expects fields to be set to 0 */
|
/* parser_initialize expects fields to be set to 0 */
|
||||||
rb_parser_t *p = (rb_parser_t *)config->calloc(1, sizeof(rb_parser_t));
|
rb_parser_t *p = (rb_parser_t *)config->calloc(1, sizeof(rb_parser_t));
|
||||||
@ -15998,7 +15998,7 @@ rb_ruby_parser_allocate(rb_parser_config_t *config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rb_parser_t *
|
rb_parser_t *
|
||||||
rb_ruby_parser_new(rb_parser_config_t *config)
|
rb_ruby_parser_new(const rb_parser_config_t *config)
|
||||||
{
|
{
|
||||||
/* parser_initialize expects fields to be set to 0 */
|
/* parser_initialize expects fields to be set to 0 */
|
||||||
rb_parser_t *p = rb_ruby_parser_allocate(config);
|
rb_parser_t *p = rb_ruby_parser_allocate(config);
|
||||||
|
@ -484,7 +484,7 @@ extern VALUE rb_eArgError;
|
|||||||
extern VALUE rb_mRubyVMFrozenCore;
|
extern VALUE rb_mRubyVMFrozenCore;
|
||||||
VALUE rb_node_case_when_optimizable_literal(const NODE *const node);
|
VALUE rb_node_case_when_optimizable_literal(const NODE *const node);
|
||||||
|
|
||||||
rb_parser_config_t rb_global_parser_config = (rb_parser_config_t) {
|
static const rb_parser_config_t rb_global_parser_config = {
|
||||||
.malloc = ruby_xmalloc,
|
.malloc = ruby_xmalloc,
|
||||||
.calloc = ruby_xcalloc,
|
.calloc = ruby_xcalloc,
|
||||||
.realloc = ruby_xrealloc,
|
.realloc = ruby_xrealloc,
|
||||||
|
@ -1439,8 +1439,8 @@ void rb_ruby_parser_free(void *ptr);
|
|||||||
rb_ast_t* rb_ruby_parser_compile_string(rb_parser_t *p, const char *f, VALUE s, int line);
|
rb_ast_t* rb_ruby_parser_compile_string(rb_parser_t *p, const char *f, VALUE s, int line);
|
||||||
|
|
||||||
#ifdef UNIVERSAL_PARSER
|
#ifdef UNIVERSAL_PARSER
|
||||||
rb_parser_t *rb_ruby_parser_allocate(rb_parser_config_t *config);
|
rb_parser_t *rb_ruby_parser_allocate(const rb_parser_config_t *config);
|
||||||
rb_parser_t *rb_ruby_parser_new(rb_parser_config_t *config);
|
rb_parser_t *rb_ruby_parser_new(const rb_parser_config_t *config);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long rb_parser_string_length(rb_parser_string_t *str);
|
long rb_parser_string_length(rb_parser_string_t *str);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user