[前][次][番号順一覧][スレッド一覧]

ruby-changes:34362

From: nobu <ko1@a...>
Date: Mon, 16 Jun 2014 17:06:47 +0900 (JST)
Subject: [ruby-changes:34362] nobu:r46443 (trunk): string.c: no copy of interned strings

nobu	2014-06-16 17:06:39 +0900 (Mon, 16 Jun 2014)

  New Revision: 46443

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46443

  Log:
    string.c: no copy of interned strings
    
    * string.c (sym_succ, sym_cmp, sym_casecmp, sym_match, sym_aref):
      not need to make copy of interned strings, use directly.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 46442)
+++ string.c	(revision 46443)
@@ -8515,7 +8515,7 @@ sym_to_proc(VALUE sym) https://github.com/ruby/ruby/blob/trunk/string.c#L8515
 static VALUE
 sym_succ(VALUE sym)
 {
-    return rb_str_dynamic_intern(rb_str_succ(rb_sym_to_s(sym)));
+    return rb_str_dynamic_intern(rb_str_succ(rb_sym2str(sym)));
 }
 
 /*
@@ -8538,7 +8538,7 @@ sym_cmp(VALUE sym, VALUE other) https://github.com/ruby/ruby/blob/trunk/string.c#L8538
     if (!SYMBOL_P(other)) {
 	return Qnil;
     }
-    return rb_str_cmp_m(rb_sym_to_s(sym), rb_sym_to_s(other));
+    return rb_str_cmp_m(rb_sym2str(sym), rb_sym2str(other));
 }
 
 /*
@@ -8555,7 +8555,7 @@ sym_casecmp(VALUE sym, VALUE other) https://github.com/ruby/ruby/blob/trunk/string.c#L8555
     if (!SYMBOL_P(other)) {
 	return Qnil;
     }
-    return rb_str_casecmp(rb_sym_to_s(sym), rb_sym_to_s(other));
+    return rb_str_casecmp(rb_sym2str(sym), rb_sym2str(other));
 }
 
 /*
@@ -8569,7 +8569,7 @@ sym_casecmp(VALUE sym, VALUE other) https://github.com/ruby/ruby/blob/trunk/string.c#L8569
 static VALUE
 sym_match(VALUE sym, VALUE other)
 {
-    return rb_str_match(rb_sym_to_s(sym), other);
+    return rb_str_match(rb_sym2str(sym), other);
 }
 
 /*
@@ -8585,7 +8585,7 @@ sym_match(VALUE sym, VALUE other) https://github.com/ruby/ruby/blob/trunk/string.c#L8585
 static VALUE
 sym_aref(int argc, VALUE *argv, VALUE sym)
 {
-    return rb_str_aref_m(argc, argv, rb_sym_to_s(sym));
+    return rb_str_aref_m(argc, argv, rb_sym2str(sym));
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]