aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authorrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-06 07:21:16 +0000
committerrhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-06 07:21:16 +0000
commit9eea596c5264a5cc947b6dd1d1a9838653e7f25e (patch)
tree894574f45692fb375158e9b51e52af8ff0bb15c7 /string.c
parentf487c97eaa87d58d3fd5938305d255c6b117b82c (diff)
downloadruby-9eea596c5264a5cc947b6dd1d1a9838653e7f25e.tar.gz
string.c: remove dead code in str_fill_term()
The length of a string never exceeds the capacity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/string.c b/string.c
index 072f1329ee..22664febfd 100644
--- a/string.c
+++ b/string.c
@@ -2117,17 +2117,10 @@ str_null_char(const char *s, long len, const int minlen, rb_encoding *enc)
static char *
str_fill_term(VALUE str, char *s, long len, int termlen)
{
- long capa = str_capacity(str, termlen);
-
/* This function assumes that (capa + termlen) bytes of memory
* is allocated, like many other functions in this file.
*/
-
- if (capa < len) {
- rb_check_lockedtmp(str);
- str_make_independent_expand(str, len, 0L, termlen);
- }
- else if (str_dependent_p(str)) {
+ if (str_dependent_p(str)) {
if (!zero_filled(s + len, termlen))
str_make_independent_expand(str, len, 0L, termlen);
}