ruby-changes:47157
From: rhe <ko1@a...>
Date: Thu, 6 Jul 2017 16:21:22 +0900 (JST)
Subject: [ruby-changes:47157] rhe:r59271 (trunk): string.c: remove dead code in str_fill_term()
rhe 2017-07-06 16:21:16 +0900 (Thu, 06 Jul 2017) New Revision: 59271 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59271 Log: string.c: remove dead code in str_fill_term() The length of a string never exceeds the capacity. Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 59270) +++ string.c (revision 59271) @@ -2117,17 +2117,10 @@ str_null_char(const char *s, long len, c https://github.com/ruby/ruby/blob/trunk/string.c#L2117 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/