This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp.c: Remove useless read-only check from S_do_chomp
authorFather Chrysostomos <sprout@cpan.org>
Wed, 23 Nov 2011 21:11:48 +0000 (13:11 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 24 Nov 2011 09:45:29 +0000 (01:45 -0800)
After sv_force_normal_flags, the scalar will no longer be read-only,
except in those cases where sv_force_normal_flags croaks.  So this
check will never be true when SvFAKE was true.

pp.c

diff --git a/pp.c b/pp.c
index a6e2f4e..9325d0e 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -797,7 +797,7 @@ S_do_chomp(pTHX_ SV *retval, SV *sv, bool chomping)
             /* SV is copy-on-write */
            sv_force_normal_flags(sv, 0);
         }
-        if (SvREADONLY(sv))
+        else
             Perl_croak_no_modify(aTHX);
     }