This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
s/// in boolean context: simplify return value
authorDavid Mitchell <davem@iabyn.com>
Tue, 19 Dec 2017 15:28:06 +0000 (15:28 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 19 Dec 2017 15:28:06 +0000 (15:28 +0000)
commit04d596853d450fae95e059c4d4d15f6750beea34
tree9ef1c3a2b2f187c5a9192e4614d0893a4ccad5d4
parent5e501dc57f49d52e0f2a302181be287457c0b736
s/// in boolean context: simplify return value

Normally s/// returns a count of the number of iterations, but
as an optimisation, in boolean context it returns PL_sv_yes/PL_sv_zero
instead. But in the places where it decides which immortal var to return,
the number of iterations is always > 0, so PL_sv_zero never gets returned.
So skip testing whether iters > 0 and always just return PL_sv_yes.

(In non-boolean scalar context, it still returns the iteration count as
before.)
pp_hot.c