summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-22 04:28:13 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-22 04:28:13 +0000
commit559d021d200a2e5457fa89a8ddbaf15ab1aeecb9 (patch)
tree1d792cc7c0f375ed4657c294201065858db2ad73 /eval.c
parentdc217e2d25d1994aadaaaac98179d374fc9c3366 (diff)
* eval.c, vm.c, vm_core.h, vm_insnhelper.c: specify "const".
* vm_opts.h: add a OPT_TOKEN_THREADED_CODE macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/eval.c b/eval.c
index d0e7e5d15d..4e5cbf8fd7 100644
--- a/eval.c
+++ b/eval.c
@@ -34,7 +34,7 @@ static VALUE exception_error;
static VALUE eval_string(VALUE, VALUE, VALUE, const char *, int);
-static inline VALUE rb_yield_0(int argc, VALUE *argv);
+static inline VALUE rb_yield_0(const int argc, const VALUE * const argv);
static VALUE rb_call(VALUE, VALUE, ID, int, const VALUE *, int);
#include "eval_error.c"
@@ -909,13 +909,13 @@ rb_need_block()
}
static inline VALUE
-rb_yield_0(int argc, VALUE *argv)
+rb_yield_0(const int argc, const VALUE * const argv)
{
return vm_yield(GET_THREAD(), argc, argv);
}
VALUE
-rb_yield(VALUE val)
+rb_yield(const VALUE val)
{
volatile VALUE tmp = val;
if (val == Qundef) {
@@ -928,7 +928,7 @@ rb_yield(VALUE val)
}
VALUE
-rb_yield_values(int n, ...)
+rb_yield_values(const int n, ...)
{
int i;
VALUE *argv;
@@ -950,13 +950,13 @@ rb_yield_values(int n, ...)
}
VALUE
-rb_yield_values2(int argc, VALUE *argv)
+rb_yield_values2(const int argc, VALUE * const argv)
{
return rb_yield_0(argc, argv);
}
VALUE
-rb_yield_splat(VALUE values)
+rb_yield_splat(const VALUE values)
{
VALUE tmp = rb_check_array_type(values);
volatile VALUE v;
@@ -968,7 +968,7 @@ rb_yield_splat(VALUE values)
}
static VALUE
-loop_i()
+loop_i(void)
{
for (;;) {
rb_yield_0(0, 0);
@@ -1000,8 +1000,8 @@ rb_f_loop(void)
}
VALUE
-rb_iterate(VALUE (*it_proc) (VALUE), VALUE data1,
- VALUE (*bl_proc) (ANYARGS), VALUE data2)
+rb_iterate(VALUE (* const it_proc) (VALUE), const VALUE data1,
+ VALUE (* const bl_proc) (ANYARGS), VALUE const data2)
{
int state;
volatile VALUE retval = Qnil;
@@ -1069,18 +1069,18 @@ struct iter_method_arg {
};
static VALUE
-iterate_method(VALUE obj)
+iterate_method(const VALUE obj)
{
- struct iter_method_arg *arg;
+ const struct iter_method_arg * const arg =
+ (struct iter_method_arg *) obj;
- arg = (struct iter_method_arg *)obj;
return rb_call(CLASS_OF(arg->obj), arg->obj, arg->mid,
arg->argc, arg->argv, CALL_FCALL);
}
VALUE
-rb_block_call(VALUE obj, ID mid, int argc, VALUE *argv,
- VALUE (*bl_proc) (ANYARGS), VALUE data2)
+rb_block_call(const VALUE obj, const ID mid, const int argc, VALUE * const argv,
+ VALUE (*const bl_proc) (ANYARGS), const VALUE data2)
{
struct iter_method_arg arg;
@@ -1092,17 +1092,17 @@ rb_block_call(VALUE obj, ID mid, int argc, VALUE *argv,
}
VALUE
-rb_each(VALUE obj)
+rb_each(const VALUE obj)
{
- return rb_call(CLASS_OF(obj), obj, rb_intern("each"), 0, 0, CALL_FCALL);
+ return rb_call(CLASS_OF(obj), obj, idEach, 0, 0, CALL_FCALL);
}
VALUE
-rb_rescue2(VALUE (*b_proc) (ANYARGS), VALUE data1, VALUE (*r_proc) (ANYARGS),
- VALUE data2, ...)
+rb_rescue2(VALUE (* const b_proc) (ANYARGS), const VALUE data1,
+ VALUE (* const r_proc) (ANYARGS), VALUE data2, ...)
{
int state;
- rb_thread_t *th = GET_THREAD();
+ rb_thread_t * const th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
volatile VALUE result;
volatile VALUE e_info = th->errinfo;
@@ -1160,14 +1160,15 @@ rb_rescue2(VALUE (*b_proc) (ANYARGS), VALUE data1, VALUE (*r_proc) (ANYARGS),
}
VALUE
-rb_rescue(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*r_proc)(ANYARGS), VALUE data2)
+rb_rescue(VALUE (* const b_proc)(ANYARGS), const VALUE data1,
+ VALUE (* const r_proc)(ANYARGS), const VALUE data2)
{
return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError,
(VALUE)0);
}
VALUE
-rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state)
+rb_protect(VALUE (* const proc) (VALUE), const VALUE data, int * const state)
{
VALUE result = Qnil; /* OK */
int status;