diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-17 09:49:58 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-17 09:49:58 +0000 |
commit | cf0106827d805eb8965e8a3b00baaef694c1c710 (patch) | |
tree | e9f676b545dd9c21d4af65d6823771ed2c153dcd /string.c | |
parent | f8e0e1647eb80d2b6e84b1ecceaaf86649719a96 (diff) | |
download | ruby-cf0106827d805eb8965e8a3b00baaef694c1c710.tar.gz |
* string.c (STR_HEAP_SIZE): includes TERM_LEN(str).
* string.c (rb_str_memsize): use STR_HEAP_SIZE().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -127,7 +127,7 @@ VALUE rb_cSymbol; } 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 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; |