summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-14 03:31:28 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-14 03:31:28 (GMT)
commit523ecd29b8acef4faa47331aaf1c6bf128b29ad6 (patch)
treedc1398668220ed51b8e352efb03713fa425de2a1 /range.c
parent3dba6dabb6b5794be9f5f17277fd256ef74c6caf (diff)
use frozen string of symbols
* range.c (range_step, range_each): String#upto should never modifies the receiver, use frozen strings to enumerate symbols. * re.c (reg_operand): matching target is not modified. * ext/socket/constants.c (constant_arg): str_to_int never modifies argument strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/range.c b/range.c
index 7ea29df..6d3c365 100644
--- a/range.c
+++ b/range.c
@@ -429,11 +429,11 @@ range_step(int argc, VALUE *argv, VALUE range)
else if (SYMBOL_P(b) && SYMBOL_P(e)) { /* symbols are special */
VALUE args[2], iter[2];
- args[0] = rb_sym_to_s(e);
+ args[0] = rb_sym2str(e);
args[1] = EXCL(range) ? Qtrue : Qfalse;
iter[0] = INT2FIX(1);
iter[1] = step;
- rb_block_call(rb_sym_to_s(b), rb_intern("upto"), 2, args, sym_step_i, (VALUE)iter);
+ rb_block_call(rb_sym2str(b), rb_intern("upto"), 2, args, sym_step_i, (VALUE)iter);
}
else if (ruby_float_step(b, e, step, EXCL(range))) {
/* done */
@@ -771,9 +771,9 @@ range_each(VALUE range)
else if (SYMBOL_P(beg) && SYMBOL_P(end)) { /* symbols are special */
VALUE args[2];
- args[0] = rb_sym_to_s(end);
+ args[0] = rb_sym2str(end);
args[1] = EXCL(range) ? Qtrue : Qfalse;
- rb_block_call(rb_sym_to_s(beg), rb_intern("upto"), 2, args, sym_each_i, 0);
+ rb_block_call(rb_sym2str(beg), rb_intern("upto"), 2, args, sym_each_i, 0);
}
else {
VALUE tmp = rb_check_string_type(beg);