1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

string.c: MAYBE_UNUSED to suppress warnings for old

Building with HAVE_MALLOC_USABLE_SIZE currently makes
SIZED_REALLOC_N ignore the old size arg.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-05-22 01:58:47 +00:00
parent 2be65894e1
commit 2fd1525b0f

View file

@ -7035,7 +7035,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
if (enc != e1) may_modify = 1;
}
if ((offset = t - buf) + tlen > max) {
size_t old = max + termlen;
size_t MAYBE_UNUSED(old) = max + termlen;
max = offset + tlen + (send - s);
SIZED_REALLOC_N(buf, char, max + termlen, old);
t = buf + offset;
@ -7108,7 +7108,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
if (enc != e1) may_modify = 1;
}
if ((offset = t - buf) + tlen > max) {
size_t old = max + termlen;
size_t MAYBE_UNUSED(old) = max + termlen;
max = offset + tlen + (long)((send - s) * 1.2);
SIZED_REALLOC_N(buf, char, max + termlen, old);
t = buf + offset;