diff options
author | Nicholas Clark <nick@ccl4.org> | 2001-12-07 17:06:56 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-07 17:27:02 +0000 |
commit | 991e6d419e6cb68835dda77416b60c341a13a26e (patch) | |
tree | 5e229781d7fcc38f738c30d7991860378bcb36cb /doop.c | |
parent | 962a6f0a381b8fd2149165ea73c61d00dc48fab9 (diff) | |
download | perl-991e6d419e6cb68835dda77416b60c341a13a26e.tar.gz |
Re: [PATCH] chom?p needs to remove read only fakery
Message-ID: <20011207170656.G21702@plum.flirble.org>
p4raw-id: //depot/perl@13521
Diffstat (limited to 'doop.c')
-rw-r--r-- | doop.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -950,8 +950,14 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv) do_chop(astr,hv_iterval(hv,entry)); return; } - else if (SvREADONLY(sv)) - Perl_croak(aTHX_ PL_no_modify); + else if (SvREADONLY(sv)) { + if (SvFAKE(sv)) { + /* SV is copy-on-write */ + sv_force_normal_flags(sv, 0); + } + if (SvREADONLY(sv)) + Perl_croak(aTHX_ PL_no_modify); + } s = SvPV(sv, len); if (len && !SvPOK(sv)) s = SvPV_force(sv, len); @@ -1020,8 +1026,14 @@ Perl_do_chomp(pTHX_ register SV *sv) count += do_chomp(hv_iterval(hv,entry)); return count; } - else if (SvREADONLY(sv)) - Perl_croak(aTHX_ PL_no_modify); + else if (SvREADONLY(sv)) { + if (SvFAKE(sv)) { + /* SV is copy-on-write */ + sv_force_normal_flags(sv, 0); + } + if (SvREADONLY(sv)) + Perl_croak(aTHX_ PL_no_modify); + } s = SvPV(sv, len); if (s && len) { s += --len; |