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

ruby-changes:32749

From: ko1 <ko1@a...>
Date: Wed, 5 Feb 2014 13:31:23 +0900 (JST)
Subject: [ruby-changes:32749] ko1:r44828 (trunk): * string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly

ko1	2014-02-05 13:31:18 +0900 (Wed, 05 Feb 2014)

  New Revision: 44828

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

  Log:
    * string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly
      because str is not embed.
    * string.c (str_replace): remove `FL_SET(str, STR_SHARED)' line
      because STR_SET_SHARED() set STR_SHARED.

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44827)
+++ ChangeLog	(revision 44828)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Feb  5 13:29:01 2014  Koichi Sasada  <ko1@a...>
+
+	* string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly
+	  because str is not embed.
+
+	* string.c (str_replace): remove `FL_SET(str, STR_SHARED)' line
+	  because STR_SET_SHARED() set STR_SHARED.
+
 Wed Feb  5 13:18:08 2014  Koichi Sasada  <ko1@a...>
 
 	* internal.h: remove macros STR_NOCAPA and STR_NOCAPA_P().
Index: string.c
===================================================================
--- string.c	(revision 44827)
+++ string.c	(revision 44828)
@@ -915,7 +915,8 @@ rb_str_free(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L915
 	st_data_t fstr = (st_data_t)str;
 	st_delete(frozen_strings, &fstr, NULL);
     }
-    if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
+
+    if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED)) {
 	ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
     }
 }
@@ -1009,7 +1010,6 @@ str_replace(VALUE str, VALUE str2) https://github.com/ruby/ruby/blob/trunk/string.c#L1010
 	STR_SET_NOEMBED(str);
 	RSTRING(str)->as.heap.len = len;
 	RSTRING(str)->as.heap.ptr = RSTRING_PTR(str2);
-	FL_SET(str, STR_SHARED);
 	STR_SET_SHARED(str, shared);
     }
     else {

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

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