Change 33618 by [EMAIL PROTECTED] on 2008/03/31 19:48:26

        Subject: [PATCH] Double magic with substr
        From: Vincent Pit <[EMAIL PROTECTED]>
        Date: Mon, 31 Mar 2008 19:05:44 +0200
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/embed.fnc#607 edit
... //depot/perl/embed.h#754 edit
... //depot/perl/global.sym#353 edit
... //depot/perl/pod/perlapi.pod#330 edit
... //depot/perl/pp.c#626 edit
... //depot/perl/proto.h#942 edit
... //depot/perl/sv.c#1532 edit

Differences ...

==== //depot/perl/embed.fnc#607 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#606~33563~   2008-03-25 04:36:22.000000000 -0700
+++ perl/embed.fnc      2008-03-31 12:48:26.000000000 -0700
@@ -884,6 +884,8 @@
 Apd    |void   |sv_inc         |NULLOK SV *const sv
 Apd    |void   |sv_insert      |NN SV *const bigstr|const STRLEN offset|const 
STRLEN len \
                                |NN const char *const little|const STRLEN 
littlelen
+Apd    |void   |sv_insert_flags|NN SV *const bigstr|const STRLEN offset|const 
STRLEN len \
+                               |NN const char *const little|const STRLEN 
littlelen|const U32 flags
 Apd    |int    |sv_isa         |NULLOK SV* sv|NN const char *const name
 Apd    |int    |sv_isobject    |NULLOK SV* sv
 Apd    |STRLEN |sv_len         |NULLOK SV *const sv

==== //depot/perl/embed.h#754 (text+w) ====
Index: perl/embed.h
--- perl/embed.h#753~33389~     2008-02-27 11:10:02.000000000 -0800
+++ perl/embed.h        2008-03-31 12:48:26.000000000 -0700
@@ -886,6 +886,7 @@
 #define sv_grow                        Perl_sv_grow
 #define sv_inc                 Perl_sv_inc
 #define sv_insert              Perl_sv_insert
+#define sv_insert_flags                Perl_sv_insert_flags
 #define sv_isa                 Perl_sv_isa
 #define sv_isobject            Perl_sv_isobject
 #define sv_len                 Perl_sv_len
@@ -3188,6 +3189,7 @@
 #define sv_grow(a,b)           Perl_sv_grow(aTHX_ a,b)
 #define sv_inc(a)              Perl_sv_inc(aTHX_ a)
 #define sv_insert(a,b,c,d,e)   Perl_sv_insert(aTHX_ a,b,c,d,e)
+#define sv_insert_flags(a,b,c,d,e,f)   Perl_sv_insert_flags(aTHX_ a,b,c,d,e,f)
 #define sv_isa(a,b)            Perl_sv_isa(aTHX_ a,b)
 #define sv_isobject(a)         Perl_sv_isobject(aTHX_ a)
 #define sv_len(a)              Perl_sv_len(aTHX_ a)

==== //depot/perl/global.sym#353 (text+w) ====
Index: perl/global.sym
--- perl/global.sym#352~33083~  2008-01-28 02:02:24.000000000 -0800
+++ perl/global.sym     2008-03-31 12:48:26.000000000 -0700
@@ -523,6 +523,7 @@
 Perl_sv_grow
 Perl_sv_inc
 Perl_sv_insert
+Perl_sv_insert_flags
 Perl_sv_isa
 Perl_sv_isobject
 Perl_sv_len

==== //depot/perl/pod/perlapi.pod#330 (text+w) ====
Index: perl/pod/perlapi.pod
--- perl/pod/perlapi.pod#329~33507~     2008-03-13 07:35:58.000000000 -0700
+++ perl/pod/perlapi.pod        2008-03-31 12:48:26.000000000 -0700
@@ -5755,13 +5755,23 @@
 X<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.
 
        void    sv_insert(SV *const bigstr, const STRLEN offset, const STRLEN 
len, const char *const little, const STRLEN littlelen)
 
 =for hackers
 Found in file sv.c
 
+=item sv_insert_flags
+X<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>.
+
+       void    sv_insert_flags(SV *const bigstr, const STRLEN offset, const 
STRLEN len, const char *const little, const STRLEN littlelen, const U32 flags)
+
+=for hackers
+Found in file sv.c
+
 =item sv_isa
 X<sv_isa>
 

==== //depot/perl/pp.c#626 (text) ====
Index: perl/pp.c
--- perl/pp.c#625~33560~        2008-03-25 02:52:27.000000000 -0700
+++ perl/pp.c   2008-03-31 12:48:26.000000000 -0700
@@ -3180,7 +3180,7 @@
            }
            if (!SvOK(sv))
                sv_setpvs(sv, "");
-           sv_insert(sv, pos, rem, repl, repl_len);
+           sv_insert_flags(sv, pos, rem, repl, repl_len, 0);
            if (repl_is_utf8)
                SvUTF8_on(sv);
            if (repl_sv_copy)

==== //depot/perl/proto.h#942 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#941~33563~     2008-03-25 04:36:22.000000000 -0700
+++ perl/proto.h        2008-03-31 12:48:26.000000000 -0700
@@ -3185,6 +3185,12 @@
 #define PERL_ARGS_ASSERT_SV_INSERT     \
        assert(bigstr); assert(little)
 
+PERL_CALLCONV 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)
+                       __attribute__nonnull__(pTHX_1)
+                       __attribute__nonnull__(pTHX_4);
+#define PERL_ARGS_ASSERT_SV_INSERT_FLAGS       \
+       assert(bigstr); assert(little)
+
 PERL_CALLCONV int      Perl_sv_isa(pTHX_ SV* sv, const char *const name)
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_SV_ISA        \

==== //depot/perl/sv.c#1532 (text) ====
Index: perl/sv.c
--- perl/sv.c#1531~33596~       2008-03-29 00:08:50.000000000 -0700
+++ perl/sv.c   2008-03-31 12:48:26.000000000 -0700
@@ -5140,7 +5140,7 @@
 =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 @@
 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 @@
 
     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);
End of Patch.

Reply via email to