summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-02-03 14:54:18 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-02-03 14:54:18 +0000
commit4056517955bef99f1d248dcaf966c0e256b0ea31 (patch)
treeb901e16f8b6443934dc90d1cac98b651a9920813 /sv.c
parentaa0053b7f4fe5f775a26681d0e18999f5a01d34c (diff)
downloadperl-4056517955bef99f1d248dcaf966c0e256b0ea31.tar.gz
Fix SvGROW on an SV with SvLEN == 0 - copy in any existing data.
(Mis-feature discovered by Encode.) p4raw-id: //depot/perlio@14526
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 8f5b0a6172..217df878b7 100644
--- a/sv.c
+++ b/sv.c
@@ -1584,6 +1584,9 @@ Perl_sv_grow(pTHX_ register SV *sv, register STRLEN newlen)
SvREADONLY_off(sv);
}
New(703, s, newlen, char);
+ if (SvPVX(sv) && SvCUR(sv)) {
+ Move(SvPVX(sv), s, SvCUR(sv), char);
+ }
}
SvPV_set(sv, s);
SvLEN_set(sv, newlen);