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

ruby-changes:31256

From: ko1 <ko1@a...>
Date: Thu, 17 Oct 2013 18:50:05 +0900 (JST)
Subject: [ruby-changes:31256] ko1:r43335 (trunk): * string.c (STR_HEAP_SIZE): includes TERM_LEN(str).

ko1	2013-10-17 18:49:58 +0900 (Thu, 17 Oct 2013)

  New Revision: 43335

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

  Log:
    * string.c (STR_HEAP_SIZE): includes TERM_LEN(str).
    * string.c (rb_str_memsize): use STR_HEAP_SIZE().

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43334)
+++ ChangeLog	(revision 43335)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Oct 17 18:45:41 2013  Koichi Sasada  <ko1@a...>
+
+	* string.c (STR_HEAP_SIZE): includes TERM_LEN(str).
+
+	* string.c (rb_str_memsize): use STR_HEAP_SIZE().
+
 Thu Oct 17 17:43:00 2013  Shugo Maeda  <shugo@r...>
 
 	* vm_insnhelper.c (vm_call_method): set ci->me to 0 when the
Index: string.c
===================================================================
--- string.c	(revision 43334)
+++ string.c	(revision 43335)
@@ -127,7 +127,7 @@ VALUE rb_cSymbol; https://github.com/ruby/ruby/blob/trunk/string.c#L127
 } while (0)
 
 #define STR_HEAP_PTR(str)  (RSTRING(str)->as.heap.ptr)
-#define STR_HEAP_SIZE(str) (RSTRING(str)->as.heap.aux.capa)
+#define STR_HEAP_SIZE(str) (RSTRING(str)->as.heap.aux.capa + TERM_LEN(str))
 
 #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
 #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
@@ -891,7 +891,7 @@ RUBY_FUNC_EXPORTED size_t https://github.com/ruby/ruby/blob/trunk/string.c#L891
 rb_str_memsize(VALUE str)
 {
     if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
-	return RSTRING(str)->as.heap.aux.capa;
+	return STR_HEAP_SIZE(str);
     }
     else {
 	return 0;

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

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