summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/string.c b/string.c
index 3eda81ca3c..936cc18ac4 100644
--- a/string.c
+++ b/string.c
@@ -8345,10 +8345,9 @@ sym_inspect(VALUE sym)
VALUE str;
const char *ptr;
long len;
- ID id = SYM2ID(sym);
char *dest;
- sym = rb_id2str(id);
+ sym = rb_sym2str(sym);
if (!rb_str_symname_p(sym)) {
str = rb_str_inspect(sym);
len = RSTRING_LEN(str);
@@ -8384,9 +8383,7 @@ sym_inspect(VALUE sym)
VALUE
rb_sym_to_s(VALUE sym)
{
- ID id = SYM2ID(sym);
-
- return str_new_shared(rb_cString, rb_id2str(id));
+ return str_new_shared(rb_cString, rb_sym2str(sym));
}
@@ -8468,7 +8465,7 @@ sym_to_proc(VALUE sym)
static VALUE
sym_succ(VALUE sym)
{
- return rb_str_intern(rb_str_succ(rb_sym_to_s(sym)));
+ return rb_str_dynamic_intern(rb_str_succ(rb_sym_to_s(sym)));
}
/*
@@ -8552,7 +8549,7 @@ sym_aref(int argc, VALUE *argv, VALUE sym)
static VALUE
sym_length(VALUE sym)
{
- return rb_str_length(rb_id2str(SYM2ID(sym)));
+ return rb_str_length(rb_sym2str(sym));
}
/*
@@ -8565,7 +8562,7 @@ sym_length(VALUE sym)
static VALUE
sym_empty(VALUE sym)
{
- return rb_str_empty(rb_id2str(SYM2ID(sym)));
+ return rb_str_empty(rb_sym2str(sym));
}
/*
@@ -8578,7 +8575,7 @@ sym_empty(VALUE sym)
static VALUE
sym_upcase(VALUE sym)
{
- return rb_str_intern(rb_str_upcase(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_upcase(rb_sym2str(sym)));
}
/*
@@ -8591,7 +8588,7 @@ sym_upcase(VALUE sym)
static VALUE
sym_downcase(VALUE sym)
{
- return rb_str_intern(rb_str_downcase(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_downcase(rb_sym2str(sym)));
}
/*
@@ -8604,7 +8601,7 @@ sym_downcase(VALUE sym)
static VALUE
sym_capitalize(VALUE sym)
{
- return rb_str_intern(rb_str_capitalize(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_capitalize(rb_sym2str(sym)));
}
/*
@@ -8617,7 +8614,7 @@ sym_capitalize(VALUE sym)
static VALUE
sym_swapcase(VALUE sym)
{
- return rb_str_intern(rb_str_swapcase(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_swapcase(rb_sym2str(sym)));
}
/*
@@ -8630,7 +8627,7 @@ sym_swapcase(VALUE sym)
static VALUE
sym_encoding(VALUE sym)
{
- return rb_obj_encoding(rb_id2str(SYM2ID(sym)));
+ return rb_obj_encoding(rb_sym2str(sym));
}
ID
@@ -8742,8 +8739,8 @@ Init_String(void)
rb_define_method(rb_cString, "<<", rb_str_concat, 1);
rb_define_method(rb_cString, "prepend", rb_str_prepend, 1);
rb_define_method(rb_cString, "crypt", rb_str_crypt, 1);
- rb_define_method(rb_cString, "intern", rb_str_intern, 0);
- rb_define_method(rb_cString, "to_sym", rb_str_intern, 0);
+ rb_define_method(rb_cString, "intern", rb_str_dynamic_intern, 0); /* in parse.y */
+ rb_define_method(rb_cString, "to_sym", rb_str_dynamic_intern, 0); /* in parse.y */
rb_define_method(rb_cString, "ord", rb_str_ord, 0);
rb_define_method(rb_cString, "include?", rb_str_include, 1);