diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-21 15:18:15 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-21 15:18:15 +0000 |
commit | 4c094940aa8544e3ee149dee57ec294a47f3099d (patch) | |
tree | 758cf308ef4ff0b1d40fd5f9a5ba2c88dfd72fa2 /insns.def | |
parent | a16e394bbf85c4e3a1920a7f4ddf46f9561c4a77 (diff) | |
download | ruby-4c094940aa8544e3ee149dee57ec294a47f3099d.tar.gz |
* insns.def, vm_insnhelper.c: specify "const".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r-- | insns.def | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -183,7 +183,7 @@ getclassvariable () (VALUE val) { - NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); + NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); val = rb_cvar_get(vm_get_cvar_base(cref), id); } @@ -198,7 +198,7 @@ setclassvariable (VALUE val) () { - NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); + NODE * const cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP()); rb_cvar_set(vm_get_cvar_base(cref), id, val); } @@ -364,11 +364,10 @@ concatstrings (VALUE val) // inc += 1 - num; { int i; - VALUE v; val = rb_str_new(0, 0); for (i = num - 1; i >= 0; i--) { - v = TOPN(i); + const VALUE v = TOPN(i); rb_str_append(val, v); } POPN(num); @@ -402,7 +401,7 @@ toregexp { VALUE rb_reg_new_ary(VALUE ary, int options); int i; - VALUE ary = rb_ary_new2(cnt); + const VALUE ary = rb_ary_new2(cnt); RBASIC(ary)->klass = 0; for (i = 0; i < cnt; i++) { rb_ary_store(ary, cnt-i-1, TOPN(i)); @@ -472,7 +471,7 @@ concatarray (VALUE ary1, VALUE ary2st) (VALUE ary) { - VALUE ary2 = ary2st; + const VALUE ary2 = ary2st; VALUE tmp1 = rb_check_convert_type(ary1, T_ARRAY, "Array", "to_a"); VALUE tmp2 = rb_check_convert_type(ary2, T_ARRAY, "Array", "to_a"); @@ -561,12 +560,11 @@ newhash (VALUE val) // inc += 1 - num; { int i; - VALUE k, v; val = rb_hash_new(); for (i = num; i > 0; i -= 2) { - v = TOPN(i - 2); - k = TOPN(i - 1); + const VALUE v = TOPN(i - 2); + const k = TOPN(i - 1); rb_hash_aset(val, k, v); } POPN(num); @@ -740,13 +738,11 @@ alias (VALUE sym1, VALUE sym2) () { - VALUE klass; - if (v_p == Qtrue) { rb_alias_variable(SYM2ID(sym1), SYM2ID(sym2)); } else { - klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP()); + const VALUE klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP()); rb_alias(klass, SYM2ID(sym1), SYM2ID(sym2)); } } @@ -762,7 +758,7 @@ undef (VALUE sym) () { - VALUE klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP()); + const VALUE klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP()); rb_undef(klass, SYM2ID(sym)); INC_VM_STATE_VERSION(); } |