1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

constify parameters

* include/ruby/intern.h: constify `argv` parameters.

* include/ruby/ruby.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-06-18 06:16:39 +00:00
parent a1660e97f5
commit e99ee55abc
23 changed files with 134 additions and 131 deletions

View file

@ -873,7 +873,7 @@ enum ary_take_pos_flags
};
static VALUE
ary_take_first_or_last(int argc, VALUE *argv, VALUE ary, enum ary_take_pos_flags last)
ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos_flags last)
{
VALUE nv;
long n;
@ -1252,7 +1252,7 @@ rb_ary_subseq(VALUE ary, long beg, long len)
*/
VALUE
rb_ary_aref(int argc, VALUE *argv, VALUE ary)
rb_ary_aref(int argc, const VALUE *argv, VALUE ary)
{
VALUE arg;
long beg, len;
@ -1347,7 +1347,7 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary)
*/
VALUE
rb_ary_last(int argc, VALUE *argv, VALUE ary)
rb_ary_last(int argc, const VALUE *argv, VALUE ary)
{
if (argc == 0) {
long len = RARRAY_LEN(ary);
@ -2736,7 +2736,7 @@ rb_ary_collect_bang(VALUE ary)
}
VALUE
rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE (*func) (VALUE, long))
rb_get_values_at(VALUE obj, long olen, int argc, const VALUE *argv, VALUE (*func) (VALUE, long))
{
VALUE result = rb_ary_new2(argc);
long beg, len, i, j;

20
class.c
View file

@ -1141,7 +1141,7 @@ method_entry_i(st_data_t key, st_data_t value, st_data_t data)
}
static VALUE
class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func) (st_data_t, st_data_t, st_data_t))
class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int (*func) (st_data_t, st_data_t, st_data_t))
{
VALUE ary;
int recur, prepended = 0;
@ -1203,7 +1203,7 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func
*/
VALUE
rb_class_instance_methods(int argc, VALUE *argv, VALUE mod)
rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_i);
}
@ -1218,7 +1218,7 @@ rb_class_instance_methods(int argc, VALUE *argv, VALUE mod)
*/
VALUE
rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_prot_i);
}
@ -1241,7 +1241,7 @@ rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
*/
VALUE
rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod)
rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_priv_i);
}
@ -1256,7 +1256,7 @@ rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod)
*/
VALUE
rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_pub_i);
}
@ -1292,7 +1292,7 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
*/
VALUE
rb_obj_methods(int argc, VALUE *argv, VALUE obj)
rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
{
rb_check_arity(argc, 0, 1);
if (argc > 0 && !RTEST(argv[0])) {
@ -1311,7 +1311,7 @@ rb_obj_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj)
rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_prot_i);
}
@ -1326,7 +1326,7 @@ rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
rb_obj_private_methods(int argc, VALUE *argv, VALUE obj)
rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_priv_i);
}
@ -1341,7 +1341,7 @@ rb_obj_private_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_pub_i);
}
@ -1380,7 +1380,7 @@ rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
rb_obj_singleton_methods(int argc, VALUE *argv, VALUE obj)
rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
{
VALUE recur, ary, klass, origin;
st_table *list, *mtbl;

View file

@ -23,8 +23,8 @@ typedef struct rb_const_entry_struct {
const VALUE file; /* should be mark */
} rb_const_entry_t;
VALUE rb_mod_private_constant(int argc, VALUE *argv, VALUE obj);
VALUE rb_mod_public_constant(int argc, VALUE *argv, VALUE obj);
VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
void rb_free_const_table(st_table *tbl);
VALUE rb_public_const_get(VALUE klass, ID id);
VALUE rb_public_const_get_at(VALUE klass, ID id);

12
cont.c
View file

@ -938,7 +938,7 @@ rb_callcc(VALUE self)
}
static VALUE
make_passing_arg(int argc, VALUE *argv)
make_passing_arg(int argc, const VALUE *argv)
{
switch (argc) {
case 0:
@ -1257,7 +1257,7 @@ return_fiber(void)
}
}
VALUE rb_fiber_transfer(VALUE fib, int argc, VALUE *argv);
VALUE rb_fiber_transfer(VALUE fib, int argc, const VALUE *argv);
static void
rb_fiber_terminate(rb_fiber_t *fib)
@ -1405,7 +1405,7 @@ fiber_store(rb_fiber_t *next_fib)
}
static inline VALUE
fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
fiber_switch(VALUE fibval, int argc, const VALUE *argv, int is_resume)
{
VALUE value;
rb_fiber_t *fib;
@ -1480,13 +1480,13 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
}
VALUE
rb_fiber_transfer(VALUE fib, int argc, VALUE *argv)
rb_fiber_transfer(VALUE fib, int argc, const VALUE *argv)
{
return fiber_switch(fib, argc, argv, 0);
}
VALUE
rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
rb_fiber_resume(VALUE fibval, int argc, const VALUE *argv)
{
rb_fiber_t *fib;
GetFiberPtr(fibval, fib);
@ -1502,7 +1502,7 @@ rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
}
VALUE
rb_fiber_yield(int argc, VALUE *argv)
rb_fiber_yield(int argc, const VALUE *argv)
{
return rb_fiber_transfer(return_fiber(), argc, argv);
}

View file

@ -267,7 +267,7 @@ enumerator_allocate(VALUE klass)
}
static VALUE
enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn, VALUE size)
enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn, VALUE size)
{
struct enumerator *ptr;
@ -398,16 +398,16 @@ enumerator_init_copy(VALUE obj, VALUE orig)
* For backwards compatibility; use rb_enumeratorize_with_size
*/
VALUE
rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
rb_enumeratorize(VALUE obj, VALUE meth, int argc, const VALUE *argv)
{
return rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
}
static VALUE
lazy_to_enum_i(VALUE self, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn);
lazy_to_enum_i(VALUE self, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn);
VALUE
rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn)
{
/* Similar effect as calling obj.to_enum, i.e. dispatching to either
Kernel#to_enum vs Lazy#to_enum */
@ -1459,7 +1459,7 @@ enumerable_lazy(VALUE obj)
}
static VALUE
lazy_to_enum_i(VALUE obj, VALUE meth, int argc, VALUE *argv, rb_enumerator_size_func *size_fn)
lazy_to_enum_i(VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn)
{
return enumerator_init(enumerator_allocate(rb_cLazy),
obj, meth, argc, argv, size_fn, Qnil);

6
eval.c
View file

@ -571,7 +571,7 @@ rb_longjmp(int tag, volatile VALUE mesg, VALUE cause)
JUMP_TAG(tag);
}
static VALUE make_exception(int argc, VALUE *argv, int isstr);
static VALUE make_exception(int argc, const VALUE *argv, int isstr);
void
rb_exc_raise(VALUE mesg)
@ -668,7 +668,7 @@ rb_f_raise(int argc, VALUE *argv)
}
static VALUE
make_exception(int argc, VALUE *argv, int isstr)
make_exception(int argc, const VALUE *argv, int isstr)
{
VALUE mesg, exc;
ID exception;
@ -719,7 +719,7 @@ make_exception(int argc, VALUE *argv, int isstr)
}
VALUE
rb_make_exception(int argc, VALUE *argv)
rb_make_exception(int argc, const VALUE *argv)
{
return make_exception(argc, argv, TRUE);
}

View file

@ -229,8 +229,8 @@ int rb_threadptr_reset_raised(rb_thread_t *th);
#define rb_thread_raised_p(th, f) (((th)->raised_flag & (f)) != 0)
#define rb_thread_raised_clear(th) ((th)->raised_flag = 0)
VALUE rb_f_eval(int argc, VALUE *argv, VALUE self);
VALUE rb_make_exception(int argc, VALUE *argv);
VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
VALUE rb_make_exception(int argc, const VALUE *argv);
NORETURN(void rb_method_name_error(VALUE, VALUE));
@ -240,7 +240,7 @@ NORETURN(void rb_print_undef(VALUE, ID, int));
NORETURN(void rb_print_undef_str(VALUE, VALUE));
NORETURN(void rb_vm_localjump_error(const char *,VALUE, int));
NORETURN(void rb_vm_jump_tag_but_local_jump(int));
NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv,
NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
VALUE obj, int call_status));
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);

4
file.c
View file

@ -3569,7 +3569,7 @@ rb_file_expand_path_fast(VALUE fname, VALUE dname)
*/
VALUE
rb_file_s_expand_path(int argc, VALUE *argv)
rb_file_s_expand_path(int argc, const VALUE *argv)
{
VALUE fname, dname;
@ -3602,7 +3602,7 @@ rb_file_absolute_path(VALUE fname, VALUE dname)
*/
VALUE
rb_file_s_absolute_path(int argc, VALUE *argv)
rb_file_s_absolute_path(int argc, const VALUE *argv)
{
VALUE fname, dname;

6
gc.c
View file

@ -3365,7 +3365,7 @@ ruby_stack_check(void)
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
static void
mark_locations_array(rb_objspace_t *objspace, register VALUE *x, register long n)
mark_locations_array(rb_objspace_t *objspace, register const VALUE *x, register long n)
{
VALUE v;
while (n--) {
@ -3376,7 +3376,7 @@ mark_locations_array(rb_objspace_t *objspace, register VALUE *x, register long n
}
static void
gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
gc_mark_locations(rb_objspace_t *objspace, const VALUE *start, const VALUE *end)
{
long n;
@ -3386,7 +3386,7 @@ gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
}
void
rb_gc_mark_locations(VALUE *start, VALUE *end)
rb_gc_mark_locations(const VALUE *start, const VALUE *end)
{
gc_mark_locations(&rb_objspace, start, end);
}

View file

@ -56,7 +56,7 @@ void rb_ary_free(VALUE);
void rb_ary_modify(VALUE);
VALUE rb_ary_freeze(VALUE);
VALUE rb_ary_shared_with_p(VALUE, VALUE);
VALUE rb_ary_aref(int, VALUE*, VALUE);
VALUE rb_ary_aref(int, const VALUE*, VALUE);
VALUE rb_ary_subseq(VALUE, long, long);
void rb_ary_store(VALUE, long, VALUE);
VALUE rb_ary_dup(VALUE);
@ -85,7 +85,7 @@ VALUE rb_ary_rassoc(VALUE, VALUE);
VALUE rb_ary_includes(VALUE, VALUE);
VALUE rb_ary_cmp(VALUE, VALUE);
VALUE rb_ary_replace(VALUE copy, VALUE orig);
VALUE rb_get_values_at(VALUE, long, int, VALUE*, VALUE(*)(VALUE,long));
VALUE rb_get_values_at(VALUE, long, int, const VALUE*, VALUE(*)(VALUE,long));
VALUE rb_ary_resize(VALUE ary, long len);
#define rb_ary_new2 rb_ary_new_capa
#define rb_ary_new3 rb_ary_new_from_args
@ -201,11 +201,11 @@ VALUE rb_include_class_new(VALUE, VALUE);
VALUE rb_mod_included_modules(VALUE);
VALUE rb_mod_include_p(VALUE, VALUE);
VALUE rb_mod_ancestors(VALUE);
VALUE rb_class_instance_methods(int, VALUE*, VALUE);
VALUE rb_class_public_instance_methods(int, VALUE*, VALUE);
VALUE rb_class_protected_instance_methods(int, VALUE*, VALUE);
VALUE rb_class_private_instance_methods(int, VALUE*, VALUE);
VALUE rb_obj_singleton_methods(int, VALUE*, VALUE);
VALUE rb_class_instance_methods(int, const VALUE*, VALUE);
VALUE rb_class_public_instance_methods(int, const VALUE*, VALUE);
VALUE rb_class_protected_instance_methods(int, const VALUE*, VALUE);
VALUE rb_class_private_instance_methods(int, const VALUE*, VALUE);
VALUE rb_obj_singleton_methods(int, const VALUE*, VALUE);
void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
void rb_frozen_class_p(VALUE);
void rb_undef(VALUE, ID);
@ -218,16 +218,16 @@ int rb_cmpint(VALUE, VALUE, VALUE);
NORETURN(void rb_cmperr(VALUE, VALUE));
/* cont.c */
VALUE rb_fiber_new(VALUE (*)(ANYARGS), VALUE);
VALUE rb_fiber_resume(VALUE fib, int argc, VALUE *args);
VALUE rb_fiber_yield(int argc, VALUE *args);
VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
VALUE rb_fiber_yield(int argc, const VALUE *argv);
VALUE rb_fiber_current(void);
VALUE rb_fiber_alive_p(VALUE);
/* enum.c */
VALUE rb_enum_values_pack(int, const VALUE*);
/* enumerator.c */
VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *);
VALUE rb_enumeratorize(VALUE, VALUE, int, const VALUE *);
typedef VALUE rb_enumerator_size_func(VALUE, VALUE, VALUE);
VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, rb_enumerator_size_func *);
VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, const VALUE *, rb_enumerator_size_func *);
#ifndef RUBY_EXPORT
#define rb_enumeratorize_with_size(obj, id, argc, argv, size_fn) \
rb_enumeratorize_with_size(obj, id, argc, argv, (rb_enumerator_size_func *)(size_fn))
@ -362,8 +362,8 @@ typedef fd_set rb_fdset_t;
NORETURN(void rb_exc_raise(VALUE));
NORETURN(void rb_exc_fatal(VALUE));
VALUE rb_f_exit(int,VALUE*);
VALUE rb_f_abort(int,VALUE*);
VALUE rb_f_exit(int, const VALUE*);
VALUE rb_f_abort(int, const VALUE*);
void rb_remove_method(VALUE, const char*);
void rb_remove_method_id(VALUE, ID);
#define rb_disable_super(klass, name) ((void)0)
@ -383,15 +383,15 @@ int rb_method_basic_definition_p(VALUE, ID);
VALUE rb_eval_cmd(VALUE, VALUE, int);
int rb_obj_respond_to(VALUE, ID, int);
int rb_respond_to(VALUE, ID);
VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj);
VALUE rb_f_notimplement(int argc, const VALUE *argv, VALUE obj);
void rb_interrupt(void);
VALUE rb_apply(VALUE, ID, VALUE);
void rb_backtrace(void);
ID rb_frame_this_func(void);
VALUE rb_obj_instance_eval(int, VALUE*, VALUE);
VALUE rb_obj_instance_exec(int, VALUE*, VALUE);
VALUE rb_mod_module_eval(int, VALUE*, VALUE);
VALUE rb_mod_module_exec(int, VALUE*, VALUE);
VALUE rb_obj_instance_eval(int, const VALUE*, VALUE);
VALUE rb_obj_instance_exec(int, const VALUE*, VALUE);
VALUE rb_mod_module_eval(int, const VALUE*, VALUE);
VALUE rb_mod_module_exec(int, const VALUE*, VALUE);
void rb_load(VALUE, int);
void rb_load_protect(VALUE, int, int*);
NORETURN(void rb_jump_tag(int));
@ -413,8 +413,8 @@ VALUE rb_proc_lambda_p(VALUE);
VALUE rb_binding_new(void);
VALUE rb_obj_method(VALUE, VALUE);
VALUE rb_obj_is_method(VALUE);
VALUE rb_method_call(int, VALUE*, VALUE);
VALUE rb_method_call_with_block(int, VALUE *, VALUE, VALUE);
VALUE rb_method_call(int, const VALUE*, VALUE);
VALUE rb_method_call_with_block(int, const VALUE *, VALUE, VALUE);
int rb_mod_method_arity(VALUE, ID);
int rb_obj_method_arity(VALUE, ID);
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
@ -449,9 +449,9 @@ VALUE rb_exec_recursive_paired_outer(VALUE(*)(VALUE, VALUE, int),VALUE,VALUE,VAL
/* dir.c */
VALUE rb_dir_getwd(void);
/* file.c */
VALUE rb_file_s_expand_path(int, VALUE *);
VALUE rb_file_s_expand_path(int, const VALUE *);
VALUE rb_file_expand_path(VALUE, VALUE);
VALUE rb_file_s_absolute_path(int, VALUE *);
VALUE rb_file_s_absolute_path(int, const VALUE *);
VALUE rb_file_absolute_path(VALUE, VALUE);
VALUE rb_file_dirname(VALUE fname);
int rb_find_file_ext_safe(VALUE*, const char* const*, int);
@ -464,7 +464,7 @@ int rb_is_absolute_path(const char *);
/* gc.c */
NORETURN(void rb_memerror(void));
int rb_during_gc(void);
void rb_gc_mark_locations(VALUE*, VALUE*);
void rb_gc_mark_locations(const VALUE*, const VALUE*);
void rb_mark_tbl(struct st_table*);
void rb_mark_set(struct st_table*);
void rb_mark_hash(struct st_table*);
@ -524,9 +524,9 @@ VALUE rb_io_eof(VALUE);
VALUE rb_io_binmode(VALUE);
VALUE rb_io_ascii8bit_binmode(VALUE);
VALUE rb_io_addstr(VALUE, VALUE);
VALUE rb_io_printf(int, VALUE*, VALUE);
VALUE rb_io_print(int, VALUE*, VALUE);
VALUE rb_io_puts(int, VALUE*, VALUE);
VALUE rb_io_printf(int, const VALUE*, VALUE);
VALUE rb_io_print(int, const VALUE*, VALUE);
VALUE rb_io_puts(int, const VALUE*, VALUE);
VALUE rb_io_fdopen(int, int, const char*);
VALUE rb_io_get_io(VALUE);
VALUE rb_file_open(const char*, const char*);
@ -619,11 +619,11 @@ VALUE rb_sym_all_symbols(void);
void rb_last_status_set(int status, rb_pid_t pid);
VALUE rb_last_status_get(void);
int rb_proc_exec(const char*);
VALUE rb_f_exec(int,VALUE*);
VALUE rb_f_exec(int, const VALUE*);
rb_pid_t rb_waitpid(rb_pid_t pid, int *status, int flags);
void rb_syswait(rb_pid_t pid);
rb_pid_t rb_spawn(int, VALUE*);
rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
rb_pid_t rb_spawn(int, const VALUE*);
rb_pid_t rb_spawn_err(int, const VALUE*, char*, size_t);
VALUE rb_proc_times(VALUE);
VALUE rb_detach_process(rb_pid_t pid);
/* range.c */
@ -666,7 +666,7 @@ VALUE rb_get_argv(void);
void *rb_load_file(const char*);
void *rb_load_file_str(VALUE);
/* signal.c */
VALUE rb_f_kill(int, VALUE*);
VALUE rb_f_kill(int, const VALUE*);
#ifdef POSIX_SIGNAL
#define posix_signal ruby_posix_signal
RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
@ -874,8 +874,8 @@ VALUE rb_class_name(VALUE);
void rb_autoload(VALUE, ID, const char*);
VALUE rb_autoload_load(VALUE, ID);
VALUE rb_autoload_p(VALUE, ID);
VALUE rb_f_trace_var(int, VALUE*);
VALUE rb_f_untrace_var(int, VALUE*);
VALUE rb_f_trace_var(int, const VALUE*);
VALUE rb_f_untrace_var(int, const VALUE*);
VALUE rb_f_global_variables(void);
void rb_alias_variable(ID, ID);
struct st_table* rb_generic_ivar_table(VALUE);
@ -892,7 +892,7 @@ VALUE rb_obj_remove_instance_variable(VALUE, VALUE);
void *rb_mod_const_at(VALUE, void*);
void *rb_mod_const_of(VALUE, void*);
VALUE rb_const_list(void*);
VALUE rb_mod_constants(int, VALUE *, VALUE);
VALUE rb_mod_constants(int, const VALUE *, VALUE);
VALUE rb_mod_remove_const(VALUE, VALUE);
int rb_const_defined(VALUE, ID);
int rb_const_defined_at(VALUE, ID);
@ -909,7 +909,7 @@ VALUE rb_cvar_get(VALUE, ID);
void rb_cv_set(VALUE, const char*, VALUE);
VALUE rb_cv_get(VALUE, const char*);
void rb_define_class_variable(VALUE, const char*, VALUE);
VALUE rb_mod_class_variables(int, VALUE*, VALUE);
VALUE rb_mod_class_variables(int, const VALUE*, VALUE);
VALUE rb_mod_remove_cvar(VALUE, VALUE);
ID rb_frame_callee(void);
@ -917,7 +917,7 @@ VALUE rb_str_succ(VALUE);
VALUE rb_time_succ(VALUE);
int rb_frame_method_id_and_class(ID *idp, VALUE *klassp);
VALUE rb_make_backtrace(void);
VALUE rb_make_exception(int, VALUE*);
VALUE rb_make_exception(int, const VALUE*);
/* deprecated */
DEPRECATED(void rb_frame_pop(void));

View file

@ -1350,7 +1350,7 @@ void rb_gvar_readonly_setter(VALUE val, ID id, void *data, struct rb_global_var
void rb_define_variable(const char*,VALUE*);
void rb_define_virtual_variable(const char*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
void rb_define_hooked_variable(const char*,VALUE*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
void rb_define_readonly_variable(const char*,VALUE*);
void rb_define_readonly_variable(const char*,const VALUE*);
void rb_define_const(VALUE,const char*,VALUE);
void rb_define_global_const(const char*,VALUE);

View file

@ -465,7 +465,7 @@ RCLASS_SET_SUPER(VALUE klass, VALUE super)
struct vtm; /* defined by timev.h */
/* array.c */
VALUE rb_ary_last(int, VALUE *, VALUE);
VALUE rb_ary_last(int, const VALUE *, VALUE);
void rb_ary_set_len(VALUE, long);
void rb_ary_delete_same(VALUE, VALUE);
@ -480,10 +480,10 @@ void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE));
void rb_class_detach_subclasses(VALUE);
void rb_class_detach_module_subclasses(VALUE);
void rb_class_remove_from_module_subclasses(VALUE);
VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj);
VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
int rb_obj_basic_to_s_p(VALUE);
VALUE rb_special_singleton_class(VALUE);
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
@ -649,7 +649,7 @@ VALUE rb_math_cos(VALUE);
VALUE rb_math_cosh(VALUE);
VALUE rb_math_exp(VALUE);
VALUE rb_math_hypot(VALUE, VALUE);
VALUE rb_math_log(int argc, VALUE *argv);
VALUE rb_math_log(int argc, const VALUE *argv);
VALUE rb_math_sin(VALUE);
VALUE rb_math_sinh(VALUE);
#if 0
@ -943,8 +943,8 @@ void Init_prelude(void);
/* vm_backtrace.c */
void Init_vm_backtrace(void);
VALUE rb_vm_thread_backtrace(int argc, VALUE *argv, VALUE thval);
VALUE rb_vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval);
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
VALUE rb_make_backtrace(void);
void rb_backtrace_print_as_bugreport(void);

8
io.c
View file

@ -6845,7 +6845,7 @@ rb_io_init_copy(VALUE dest, VALUE io)
*/
VALUE
rb_io_printf(int argc, VALUE *argv, VALUE out)
rb_io_printf(int argc, const VALUE *argv, VALUE out)
{
rb_io_write(out, rb_f_sprintf(argc, argv));
return Qnil;
@ -6904,7 +6904,7 @@ rb_f_printf(int argc, VALUE *argv)
*/
VALUE
rb_io_print(int argc, VALUE *argv, VALUE out)
rb_io_print(int argc, const VALUE *argv, VALUE out)
{
int i;
VALUE line;
@ -6952,7 +6952,7 @@ rb_io_print(int argc, VALUE *argv, VALUE out)
*/
static VALUE
rb_f_print(int argc, VALUE *argv)
rb_f_print(int argc, const VALUE *argv)
{
rb_io_print(argc, argv, rb_stdout);
return Qnil;
@ -7069,7 +7069,7 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
*/
VALUE
rb_io_puts(int argc, VALUE *argv, VALUE out)
rb_io_puts(int argc, const VALUE *argv, VALUE out)
{
int i;
VALUE line;

10
iseq.c
View file

@ -1152,9 +1152,9 @@ id_to_name(ID id, VALUE default_value)
}
VALUE
rb_insn_operand_intern(rb_iseq_t *iseq,
rb_insn_operand_intern(const rb_iseq_t *iseq,
VALUE insn, int op_no, VALUE op,
int len, size_t pos, VALUE *pnop, VALUE child)
int len, size_t pos, const VALUE *pnop, VALUE child)
{
const char *types = insn_op_types(insn);
char type = types[op_no];
@ -1172,7 +1172,7 @@ rb_insn_operand_intern(rb_iseq_t *iseq,
case TS_LINDEX:{
if (insn == BIN(getlocal) || insn == BIN(setlocal)) {
if (pnop) {
rb_iseq_t *diseq = iseq;
const rb_iseq_t *diseq = iseq;
VALUE level = *pnop, i;
for (i = 0; i < level; i++) {
@ -1280,8 +1280,8 @@ rb_insn_operand_intern(rb_iseq_t *iseq,
* Iseq -> Iseq inspect object
*/
int
rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, size_t pos,
rb_iseq_t *iseqdat, VALUE child)
rb_iseq_disasm_insn(VALUE ret, const VALUE *iseq, size_t pos,
const rb_iseq_t *iseqdat, VALUE child)
{
VALUE insn = iseq[pos];
int len = insn_len(insn);

4
math.c
View file

@ -456,7 +456,7 @@ static double math_log1(VALUE x);
*/
static VALUE
math_log(int argc, VALUE *argv, VALUE obj)
math_log(int argc, const VALUE *argv, VALUE obj)
{
VALUE x, base;
double d;
@ -918,7 +918,7 @@ exp1(exp)
exp2(hypot)
VALUE
rb_math_log(int argc, VALUE *argv)
rb_math_log(int argc, const VALUE *argv)
{
return math_log(argc, argv, rb_mMath);
}

4
proc.c
View file

@ -1873,14 +1873,14 @@ method_clone(VALUE self)
*/
VALUE
rb_method_call(int argc, VALUE *argv, VALUE method)
rb_method_call(int argc, const VALUE *argv, VALUE method)
{
VALUE proc = rb_block_given_p() ? rb_block_proc() : Qnil;
return rb_method_call_with_block(argc, argv, method, proc);
}
VALUE
rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procval)
rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE pass_procval)
{
VALUE result = Qnil; /* OK */
struct METHOD *data;

View file

@ -2435,7 +2435,7 @@ static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *er
*/
VALUE
rb_f_exec(int argc, VALUE *argv)
rb_f_exec(int argc, const VALUE *argv)
{
VALUE execarg_obj, fail_str;
struct rb_execarg *eargp;
@ -3585,7 +3585,7 @@ rb_exit(int status)
*/
VALUE
rb_f_exit(int argc, VALUE *argv)
rb_f_exit(int argc, const VALUE *argv)
{
VALUE status;
int istatus;
@ -3614,8 +3614,9 @@ rb_f_exit(int argc, VALUE *argv)
*/
VALUE
rb_f_abort(int argc, VALUE *argv)
rb_f_abort(int argc, const VALUE *argv)
{
rb_check_arity(argc, 0, 1);
if (argc == 0) {
if (!NIL_P(GET_THREAD()->errinfo)) {
ruby_error_print();
@ -3625,9 +3626,9 @@ rb_f_abort(int argc, VALUE *argv)
else {
VALUE args[2];
rb_scan_args(argc, argv, "1", &args[1]);
StringValue(argv[0]);
rb_io_puts(argc, argv, rb_stderr);
args[1] = args[0] = argv[0];
StringValue(args[0]);
rb_io_puts(1, args, rb_stderr);
args[0] = INT2NUM(EXIT_FAILURE);
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
@ -3694,7 +3695,7 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
}
static rb_pid_t
rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
rb_spawn_internal(int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
VALUE execarg_obj;
struct rb_execarg *eargp;
@ -3709,13 +3710,13 @@ rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
}
rb_pid_t
rb_spawn_err(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
rb_spawn_err(int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
return rb_spawn_internal(argc, argv, errmsg, errmsg_buflen);
}
rb_pid_t
rb_spawn(int argc, VALUE *argv)
rb_spawn(int argc, const VALUE *argv)
{
return rb_spawn_internal(argc, argv, NULL, 0);
}

View file

@ -388,7 +388,7 @@ static void signal_enque(int sig);
*/
VALUE
rb_f_kill(int argc, VALUE *argv)
rb_f_kill(int argc, const VALUE *argv)
{
#ifndef HAVE_KILLPG
#define killpg(pg, sig) kill(-(pg), (sig))

View file

@ -607,9 +607,9 @@ rb_define_variable(const char *name, VALUE *var)
}
void
rb_define_readonly_variable(const char *name, VALUE *var)
rb_define_readonly_variable(const char *name, const VALUE *var)
{
rb_define_hooked_variable(name, var, 0, readonly_setter);
rb_define_hooked_variable(name, (VALUE *)var, 0, readonly_setter);
}
void
@ -653,7 +653,7 @@ rb_trace_eval(VALUE cmd, VALUE val)
*/
VALUE
rb_f_trace_var(int argc, VALUE *argv)
rb_f_trace_var(int argc, const VALUE *argv)
{
VALUE var, cmd;
struct global_entry *entry;
@ -712,7 +712,7 @@ remove_trace(struct global_variable *var)
*/
VALUE
rb_f_untrace_var(int argc, VALUE *argv)
rb_f_untrace_var(int argc, const VALUE *argv)
{
VALUE var, cmd;
ID id;
@ -2066,7 +2066,7 @@ rb_const_list(void *data)
*/
VALUE
rb_mod_constants(int argc, VALUE *argv, VALUE mod)
rb_mod_constants(int argc, const VALUE *argv, VALUE mod)
{
VALUE inherit;
@ -2240,7 +2240,7 @@ rb_define_global_const(const char *name, VALUE val)
}
static void
set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag)
set_const_visibility(VALUE mod, int argc, const VALUE *argv, rb_const_flag_t flag)
{
int i;
st_data_t v;
@ -2286,7 +2286,7 @@ set_const_visibility(VALUE mod, int argc, VALUE *argv, rb_const_flag_t flag)
*/
VALUE
rb_mod_private_constant(int argc, VALUE *argv, VALUE obj)
rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj)
{
set_const_visibility(obj, argc, argv, CONST_PRIVATE);
return obj;
@ -2300,7 +2300,7 @@ rb_mod_private_constant(int argc, VALUE *argv, VALUE obj)
*/
VALUE
rb_mod_public_constant(int argc, VALUE *argv, VALUE obj)
rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj)
{
set_const_visibility(obj, argc, argv, CONST_PUBLIC);
return obj;
@ -2526,7 +2526,7 @@ cvar_list(void *data)
*/
VALUE
rb_mod_class_variables(int argc, VALUE *argv, VALUE mod)
rb_mod_class_variables(int argc, const VALUE *argv, VALUE mod)
{
VALUE inherit;
st_table *tbl;

View file

@ -820,7 +820,7 @@ rb_make_backtrace(void)
}
static VALUE
vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int lev_plus, int to_str)
vm_backtrace_to_ary(rb_thread_t *th, int argc, const VALUE *argv, int lev_default, int lev_plus, int to_str)
{
VALUE level, vn;
long lev, n;
@ -891,7 +891,7 @@ vm_backtrace_to_ary(rb_thread_t *th, int argc, VALUE *argv, int lev_default, int
}
static VALUE
thread_backtrace_to_ary(int argc, VALUE *argv, VALUE thval, int to_str)
thread_backtrace_to_ary(int argc, const VALUE *argv, VALUE thval, int to_str)
{
rb_thread_t *th;
GetThreadPtr(thval, th);
@ -903,13 +903,13 @@ thread_backtrace_to_ary(int argc, VALUE *argv, VALUE thval, int to_str)
}
VALUE
rb_vm_thread_backtrace(int argc, VALUE *argv, VALUE thval)
rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval)
{
return thread_backtrace_to_ary(argc, argv, thval, 1);
}
VALUE
rb_vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval)
rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval)
{
return thread_backtrace_to_ary(argc, argv, thval, 0);
}

View file

@ -677,7 +677,7 @@ VALUE rb_iseq_compile_on_base(VALUE src, VALUE file, VALUE line, rb_block_t *bas
VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt);
VALUE rb_iseq_disasm(VALUE self);
int rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, size_t pos, rb_iseq_t *iseq, VALUE child);
int rb_iseq_disasm_insn(VALUE str, const VALUE *iseqval, size_t pos, const rb_iseq_t *iseq, VALUE child);
const char *ruby_node_name(int node);
RUBY_EXTERN VALUE rb_cISeq;

View file

@ -729,7 +729,7 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
}
void
rb_raise_method_missing(rb_thread_t *th, int argc, VALUE *argv,
rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
VALUE obj, int call_status)
{
th->passed_block = 0;
@ -1352,7 +1352,7 @@ eval_string(VALUE self, VALUE src, VALUE scope, VALUE file, int line)
*/
VALUE
rb_f_eval(int argc, VALUE *argv, VALUE self)
rb_f_eval(int argc, const VALUE *argv, VALUE self)
{
VALUE src, scope, vfile, vline;
VALUE file = Qundef;
@ -1570,7 +1570,7 @@ eval_under(VALUE under, VALUE self, VALUE src, VALUE file, int line)
}
static VALUE
specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
specific_eval(int argc, const VALUE *argv, VALUE klass, VALUE self)
{
if (rb_block_given_p()) {
rb_check_arity(argc, 0, 0);
@ -1579,16 +1579,18 @@ specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
else {
VALUE file = Qundef;
int line = 1;
VALUE code;
rb_check_arity(argc, 1, 3);
SafeStringValue(argv[0]);
code = argv[0];
SafeStringValue(code);
if (argc > 2)
line = NUM2INT(argv[2]);
if (argc > 1) {
file = argv[1];
if (!NIL_P(file)) StringValue(file);
}
return eval_under(klass, self, argv[0], file, line);
return eval_under(klass, self, code, file, line);
}
}
@ -1626,7 +1628,7 @@ specific_eval(int argc, VALUE *argv, VALUE klass, VALUE self)
*/
VALUE
rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
rb_obj_instance_eval(int argc, const VALUE *argv, VALUE self)
{
VALUE klass;
@ -1658,7 +1660,7 @@ rb_obj_instance_eval(int argc, VALUE *argv, VALUE self)
*/
VALUE
rb_obj_instance_exec(int argc, VALUE *argv, VALUE self)
rb_obj_instance_exec(int argc, const VALUE *argv, VALUE self)
{
VALUE klass;
@ -1697,7 +1699,7 @@ rb_obj_instance_exec(int argc, VALUE *argv, VALUE self)
*/
VALUE
rb_mod_module_eval(int argc, VALUE *argv, VALUE mod)
rb_mod_module_eval(int argc, const VALUE *argv, VALUE mod)
{
return specific_eval(argc, argv, mod, mod);
}
@ -1725,7 +1727,7 @@ rb_mod_module_eval(int argc, VALUE *argv, VALUE mod)
*/
VALUE
rb_mod_module_exec(int argc, VALUE *argv, VALUE mod)
rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod)
{
return yield_under(mod, mod, rb_ary_new4(argc, argv));
}

View file

@ -94,7 +94,7 @@ rb_clear_method_cache_by_class(VALUE klass)
}
VALUE
rb_f_notimplement(int argc, VALUE *argv, VALUE obj)
rb_f_notimplement(int argc, const VALUE *argv, VALUE obj)
{
rb_notimplement();
@ -1336,7 +1336,7 @@ rb_mod_alias_method(VALUE mod, VALUE newname, VALUE oldname)
}
static void
set_method_visibility(VALUE self, int argc, VALUE *argv, rb_method_flag_t ex)
set_method_visibility(VALUE self, int argc, const VALUE *argv, rb_method_flag_t ex)
{
int i;
@ -1357,7 +1357,7 @@ set_method_visibility(VALUE self, int argc, VALUE *argv, rb_method_flag_t ex)
}
static VALUE
set_visibility(int argc, VALUE *argv, VALUE module, rb_method_flag_t ex)
set_visibility(int argc, const VALUE *argv, VALUE module, rb_method_flag_t ex)
{
if (argc == 0) {
SCOPE_SET(ex);