This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
doop.c: Simplify do_trans’ un-cow logic
authorFather Chrysostomos <sprout@cpan.org>
Sat, 28 Jul 2012 06:59:19 +0000 (23:59 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 28 Jul 2012 06:59:19 +0000 (23:59 -0700)
Since it calls SvPV_force_nomg a little further on, there is no need
for a separate sv_force_normal call to handle COWs.

doop.c

diff --git a/doop.c b/doop.c
index bfcdef5..9d75b3d 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -632,9 +632,7 @@ Perl_do_trans(pTHX_ SV *sv)
     PERL_ARGS_ASSERT_DO_TRANS;
 
     if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL)) {
-        if (SvIsCOW(sv))
-            sv_force_normal_flags(sv, 0);
-        if (SvREADONLY(sv))
+        if (!SvIsCOW(sv))
             Perl_croak_no_modify(aTHX);
     }
     (void)SvPV_const(sv, len);