ruby-changes:33274
From: ko1 <ko1@a...>
Date: Mon, 17 Mar 2014 13:20:23 +0900 (JST)
Subject: [ruby-changes:33274] ko1:r45353 (trunk): * enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR()
ko1 2014-03-17 13:20:16 +0900 (Mon, 17 Mar 2014) New Revision: 45353 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45353 Log: * enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR() instead of RARRAY_PTR(). * io.c (rb_io_s_popen): ditto. * numeric.c (num_step_size): ditto. * vm_eval.c (rb_apply): ditto. * vm_eval.c (rb_eval_cmd): ditto. Modified files: trunk/ChangeLog trunk/enumerator.c trunk/io.c trunk/numeric.c trunk/vm_eval.c Index: ChangeLog =================================================================== --- ChangeLog (revision 45352) +++ ChangeLog (revision 45353) @@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Mar 17 13:17:47 2014 Koichi Sasada <ko1@a...> + + * enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR() + instead of RARRAY_PTR(). + + * io.c (rb_io_s_popen): ditto. + + * numeric.c (num_step_size): ditto. + + * vm_eval.c (rb_apply): ditto. + + * vm_eval.c (rb_eval_cmd): ditto. + Mon Mar 17 10:11:59 2014 Eric Wong <e@8...> * variable.c (rb_const_set): delete existing entry on redefinition Index: enumerator.c =================================================================== --- enumerator.c (revision 45352) +++ enumerator.c (revision 45353) @@ -422,13 +422,13 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enumerator.c#L422 enumerator_block_call(VALUE obj, rb_block_call_func *func, VALUE arg) { int argc = 0; - VALUE *argv = 0; + const VALUE *argv = 0; const struct enumerator *e = enumerator_ptr(obj); ID meth = e->meth; if (e->args) { argc = RARRAY_LENINT(e->args); - argv = RARRAY_PTR(e->args); + argv = RARRAY_CONST_PTR(e->args); } return rb_block_call(e->obj, meth, argc, argv, func, arg); } Index: io.c =================================================================== --- io.c (revision 45352) +++ io.c (revision 45353) @@ -6227,7 +6227,7 @@ rb_io_s_popen(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/io.c#L6227 #endif tmp = rb_ary_dup(tmp); RBASIC_CLEAR_CLASS(tmp); - execarg_obj = rb_execarg_new((int)len, RARRAY_PTR(tmp), FALSE); + execarg_obj = rb_execarg_new((int)len, RARRAY_CONST_PTR(tmp), FALSE); rb_ary_clear(tmp); } else { Index: vm_eval.c =================================================================== --- vm_eval.c (revision 45352) +++ vm_eval.c (revision 45353) @@ -751,7 +751,7 @@ rb_apply(VALUE recv, ID mid, VALUE args) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L751 args = rb_ary_subseq(args, 0, argc); RBASIC_CLEAR_CLASS(args); OBJ_FREEZE(args); - ret = rb_call(recv, mid, argc, RARRAY_PTR(args), CALL_FCALL); + ret = rb_call(recv, mid, argc, RARRAY_CONST_PTR(args), CALL_FCALL); RB_GC_GUARD(args); return ret; } @@ -1482,7 +1482,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int le https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1482 rb_set_safe_level_force(level); if ((state = EXEC_TAG()) == 0) { val = rb_funcall2(cmd, rb_intern("call"), RARRAY_LENINT(arg), - RARRAY_PTR(arg)); + RARRAY_CONST_PTR(arg)); } POP_TAG(); Index: numeric.c =================================================================== --- numeric.c (revision 45352) +++ numeric.c (revision 45353) @@ -1889,7 +1889,7 @@ num_step_size(VALUE from, VALUE args, VA https://github.com/ruby/ruby/blob/trunk/numeric.c#L1889 VALUE to, step, hash; int desc; int argc = args ? RARRAY_LENINT(args) : 0; - VALUE *argv = args ? RARRAY_PTR(args) : 0; + const VALUE *argv = args ? RARRAY_CONST_PTR(args) : 0; NUM_STEP_SCAN_ARGS(argc, argv, to, step, hash, desc); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/