summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-04-18 15:23:45 +0000
committerNicholas Clark <nick@ccl4.org>2005-04-18 15:23:45 +0000
commitd5b5861bfad2c5081a544610aa6f33c0ea24ea2b (patch)
tree4273f73d4654482354e873f66ca35755a558cd8b /pp_hot.c
parenta6f787ca70fe8281557cb1a6f45d147f91cb88bb (diff)
downloadperl-d5b5861bfad2c5081a544610aa6f33c0ea24ea2b.tar.gz
Refactor the odd-one-out code before a Renew(SvPVX(...)...)
p4raw-id: //depot/perl@24241
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 9fa0e07222..1a23c90ea1 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1632,10 +1632,9 @@ Perl_do_readline(pTHX)
}
else if (gimme == G_SCALAR && !tmplen && SvLEN(sv) - SvCUR(sv) > 80) {
/* try to reclaim a bit of scalar space (only on 1st alloc) */
- if (SvCUR(sv) < 60)
- SvLEN_set(sv, 80);
- else
- SvLEN_set(sv, SvCUR(sv)+40); /* allow some slop */
+ const STRLEN new_len
+ = SvCUR(sv) < 60 ? 80 : SvCUR(sv)+40; /* allow some slop */
+ SvLEN_set(sv, new_len);
Renew(SvPVX(sv), SvLEN(sv), char);
}
RETURN;