summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2008-03-31 21:05:44 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-03-31 19:48:26 +0000
commitc0dd94a09fcdb6ab5e0b1ca3c71b5902301ca665 (patch)
tree23866137031f3fe990b0966110796c205f8855f3 /sv.c
parentcc8432b2c2234e63e6e0a56afb004bdbc786967e (diff)
downloadperl-c0dd94a09fcdb6ab5e0b1ca3c71b5902301ca665.tar.gz
Double magic with substr
Message-ID: <47F119E8.5010106@profvince.com> p4raw-id: //depot/perl@33618
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sv.c b/sv.c
index f2b24a6787..deefc33257 100644
--- a/sv.c
+++ b/sv.c
@@ -5140,7 +5140,7 @@ Perl_sv_kill_backrefs(pTHX_ SV *const sv, AV *const av)
=for apidoc sv_insert
Inserts a string at the specified offset/length within the SV. Similar to
-the Perl substr() function.
+the Perl substr() function. Handles get magic.
=cut
*/
@@ -5149,6 +5149,20 @@ void
Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len,
const char *const little, const STRLEN littlelen)
{
+ sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC);
+}
+
+/*
+=for apidoc sv_insert_flags
+
+Same as C<sv_insert>, but the extra C<flags> are passed the C<SvPV_force_flags> that applies to C<bigstr>.
+
+=cut
+*/
+
+void
+Perl_sv_insert_flags(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, const char *const little, const STRLEN littlelen, const U32 flags)
+{
dVAR;
register char *big;
register char *mid;
@@ -5161,7 +5175,7 @@ Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len,
if (!bigstr)
Perl_croak(aTHX_ "Can't modify non-existent substring");
- SvPV_force(bigstr, curlen);
+ SvPV_force_flags(bigstr, curlen, flags);
(void)SvPOK_only_UTF8(bigstr);
if (offset + len > curlen) {
SvGROW(bigstr, offset+len+1);