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

ruby-changes:39076

From: nobu <ko1@a...>
Date: Mon, 6 Jul 2015 11:24:39 +0900 (JST)
Subject: [ruby-changes:39076] nobu:r51157 (trunk): string.c: register_fstring

nobu	2015-07-06 11:24:29 +0900 (Mon, 06 Jul 2015)

  New Revision: 51157

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

  Log:
    string.c: register_fstring
    
    * string.c (register_fstring): separate registration from
      rb_fstring().
    
    * string.c (rb_fstring_new): skip argument checks in rb_fstring().

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 51156)
+++ string.c	(revision 51157)
@@ -212,6 +212,7 @@ static int fstring_cmp(VALUE a, VALUE b) https://github.com/ruby/ruby/blob/trunk/string.c#L212
 
 /* in case we restart MVM development, this needs to be per-VM */
 static st_table* frozen_strings;
+static VALUE register_fstring(VALUE str);
 
 static inline st_table*
 rb_vm_fstring_table(void)
@@ -260,13 +261,19 @@ fstr_update_callback(st_data_t *key, st_ https://github.com/ruby/ruby/blob/trunk/string.c#L261
 VALUE
 rb_fstring(VALUE str)
 {
-    VALUE ret;
-
     Check_Type(str, T_STRING);
 
     if (FL_TEST(str, RSTRING_FSTR))
 	return str;
 
+    return register_fstring(str);
+}
+
+static VALUE
+register_fstring(VALUE str)
+{
+    VALUE ret;
+
     do {
 	ret = str;
 	st_update(rb_vm_fstring_table(), (st_data_t)str,
@@ -301,7 +308,7 @@ VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L308
 rb_fstring_new(const char *ptr, long len)
 {
     struct RString fake_str;
-    return rb_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII));
+    return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII));
 }
 
 VALUE

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

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