diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-05 04:21:30 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-05 04:21:30 +0000 |
commit | 38cd45a3cdacf6d0bea95e3da41d7ae09da90fb7 (patch) | |
tree | acfb06f0455fe54f37b046463cd189b2ba7df79b /string.c | |
parent | 84d8104ed6b2a6020e8c142a2cc759beb4b3d4a9 (diff) | |
download | ruby-38cd45a3cdacf6d0bea95e3da41d7ae09da90fb7.tar.gz |
* internal.h: remove macros STR_NOCAPA and STR_NOCAPA_P().
* string.c (rb_str_resize): remove `STR_SET_NOEMBED(str)' because
str_make_independent_expand() set NOEMBED flag.
* string.c (rb_str_resize): remove `STR_NOCAPA_P(str)' check because
`str' is independent (not shared).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1962,6 +1962,7 @@ rb_str_resize(VALUE str, long len) independent = str_independent(str); ENC_CODERANGE_CLEAR(str); slen = RSTRING_LEN(str); + if (len != slen) { const int termlen = TERM_LEN(str); if (STR_EMBED_P(str)) { @@ -1971,7 +1972,6 @@ rb_str_resize(VALUE str, long len) return str; } str_make_independent_expand(str, len - slen); - STR_SET_NOEMBED(str); } else if (len + termlen <= RSTRING_EMBED_LEN_MAX + 1) { char *ptr = STR_HEAP_PTR(str); @@ -1989,9 +1989,7 @@ rb_str_resize(VALUE str, long len) else if (slen < len || slen - len > 1024) { REALLOC_N(RSTRING(str)->as.heap.ptr, char, len + termlen); } - if (!STR_NOCAPA_P(str)) { - RSTRING(str)->as.heap.aux.capa = len; - } + RSTRING(str)->as.heap.aux.capa = len; RSTRING(str)->as.heap.len = len; TERM_FILL(RSTRING(str)->as.heap.ptr + len, termlen); /* sentinel */ } |