summaryrefslogtreecommitdiff
path: root/doop.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2001-05-18 00:55:25 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-20 10:57:00 +0000
commit9b33ce3b1592d0c13aec55cf7c63e0b9253b6b22 (patch)
tree2825f65aaca1384f881a7f20d05d87a6cb759a87 /doop.c
parente9fd7a0eb5d53105494ad0f7f42d2975607b8d82 (diff)
downloadperl-9b33ce3b1592d0c13aec55cf7c63e0b9253b6b22.tar.gz
Chomp should not always stringify
Message-ID: <lrk83eogf6.fsf@caliper.ActiveState.com> p4raw-id: //depot/perl@10161
Diffstat (limited to 'doop.c')
-rw-r--r--doop.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/doop.c b/doop.c
index 755cbfd16a..9550b3e390 100644
--- a/doop.c
+++ b/doop.c
@@ -989,6 +989,7 @@ Perl_do_chomp(pTHX_ register SV *sv)
{
register I32 count;
STRLEN len;
+ STRLEN n_a;
char *s;
if (RsSNARF(PL_rs))
@@ -1020,8 +1021,6 @@ Perl_do_chomp(pTHX_ register SV *sv)
else if (SvREADONLY(sv))
Perl_croak(aTHX_ PL_no_modify);
s = SvPV(sv, len);
- if (len && !SvPOKp(sv))
- s = SvPV_force(sv, len);
if (s && len) {
s += --len;
if (RsPARA(PL_rs)) {
@@ -1052,12 +1051,13 @@ Perl_do_chomp(pTHX_ register SV *sv)
count += rslen;
}
}
- *s = '\0';
+ s = SvPV_force(sv, n_a);
SvCUR_set(sv, len);
+ *SvEND(sv) = '\0';
SvNIOK_off(sv);
+ SvSETMAGIC(sv);
}
nope:
- SvSETMAGIC(sv);
return count;
}