1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

symbol.c: rename rb_str_dynamic_intern

* iseq.c, marshal.c, string.c: use rb_str_intern instead of
  rb_str_dynamic_intern.
* symbol.c (rb_str_intern): rename rb_str_dynamic_intern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-10-14 07:23:01 +00:00
parent 18828191d4
commit 5617e31771
6 changed files with 20 additions and 24 deletions

View file

@ -1,3 +1,10 @@
Tue Oct 14 16:22:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* iseq.c, marshal.c, string.c: use rb_str_intern instead of
rb_str_dynamic_intern.
* symbol.c (rb_str_intern): rename rb_str_dynamic_intern.
Tue Oct 14 10:19:10 2014 Eric Wong <e@80x24.org>
* test/ruby/test_optimization.rb (test_string_freeze): new test

View file

@ -822,7 +822,6 @@ int rb_is_method_name(VALUE name);
int rb_is_junk_name(VALUE name);
ID rb_make_internal_id(void);
void rb_gc_free_dsymbol(VALUE);
VALUE rb_str_dynamic_intern(VALUE);
ID rb_id_attrget(ID id);
/* proc.c */

2
iseq.c
View file

@ -1617,7 +1617,7 @@ ruby_node_name(int node)
static VALUE
register_label(struct st_table *table, unsigned long idx)
{
VALUE sym = rb_str_dynamic_intern(rb_sprintf("label_%lu", idx));
VALUE sym = rb_str_intern(rb_sprintf("label_%lu", idx));
st_insert(table, idx, sym);
return sym;
}

View file

@ -452,7 +452,7 @@ static void
w_unique(VALUE s, struct dump_arg *arg)
{
must_not_be_anonymous("class", s);
w_symbol(rb_str_dynamic_intern(s), arg);
w_symbol(rb_str_intern(s), arg);
}
static void w_object(VALUE,struct dump_arg*,int);
@ -1327,7 +1327,7 @@ r_symreal(struct load_arg *arg, int ivar)
}
}
if (idx > 0) rb_enc_associate_index(s, idx);
sym = rb_str_dynamic_intern(s);
sym = rb_str_intern(s);
st_insert(arg->symbols, (st_data_t)n, (st_data_t)sym);
return sym;

View file

@ -7548,16 +7548,6 @@ rb_str_crypt(VALUE str, VALUE salt)
}
VALUE
rb_str_intern(VALUE str)
{
ID id;
id = rb_intern_str(str);
return ID2SYM(id);
}
/*
* call-seq:
* str.ord -> integer
@ -8633,7 +8623,7 @@ sym_to_proc(VALUE sym)
static VALUE
sym_succ(VALUE sym)
{
return rb_str_dynamic_intern(rb_str_succ(rb_sym2str(sym)));
return rb_str_intern(rb_str_succ(rb_sym2str(sym)));
}
/*
@ -8743,7 +8733,7 @@ sym_empty(VALUE sym)
static VALUE
sym_upcase(VALUE sym)
{
return rb_str_dynamic_intern(rb_str_upcase(rb_sym2str(sym)));
return rb_str_intern(rb_str_upcase(rb_sym2str(sym)));
}
/*
@ -8756,7 +8746,7 @@ sym_upcase(VALUE sym)
static VALUE
sym_downcase(VALUE sym)
{
return rb_str_dynamic_intern(rb_str_downcase(rb_sym2str(sym)));
return rb_str_intern(rb_str_downcase(rb_sym2str(sym)));
}
/*
@ -8769,7 +8759,7 @@ sym_downcase(VALUE sym)
static VALUE
sym_capitalize(VALUE sym)
{
return rb_str_dynamic_intern(rb_str_capitalize(rb_sym2str(sym)));
return rb_str_intern(rb_str_capitalize(rb_sym2str(sym)));
}
/*
@ -8782,7 +8772,7 @@ sym_capitalize(VALUE sym)
static VALUE
sym_swapcase(VALUE sym)
{
return rb_str_dynamic_intern(rb_str_swapcase(rb_sym2str(sym)));
return rb_str_intern(rb_str_swapcase(rb_sym2str(sym)));
}
/*
@ -8829,7 +8819,7 @@ rb_to_symbol(VALUE name)
return name;
}
name = string_for_symbol(name);
return rb_str_dynamic_intern(name);
return rb_str_intern(name);
}
/*
@ -8922,8 +8912,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_dynamic_intern, 0); /* in symbol.c */
rb_define_method(rb_cString, "to_sym", rb_str_dynamic_intern, 0); /* in symbol.c */
rb_define_method(rb_cString, "intern", rb_str_intern, 0); /* in symbol.c */
rb_define_method(rb_cString, "to_sym", rb_str_intern, 0); /* in symbol.c */
rb_define_method(rb_cString, "ord", rb_str_ord, 0);
rb_define_method(rb_cString, "include?", rb_str_include, 1);

View file

@ -155,7 +155,7 @@ rb_id_attrset(ID id)
/* make new dynamic symbol */
str = rb_str_dup(RSYMBOL((VALUE)id)->fstr);
rb_str_cat(str, "=", 1);
id = SYM2ID(rb_str_dynamic_intern(str));
id = SYM2ID(rb_str_intern(str));
}
return id;
}
@ -741,7 +741,7 @@ rb_gc_free_dsymbol(VALUE sym)
*/
VALUE
rb_str_dynamic_intern(VALUE str)
rb_str_intern(VALUE str)
{
#if USE_SYMBOL_GC
rb_encoding *enc, *ascii;