From 1e6bda93199bc72086fd20f4dab89d46590b379a Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 23 Dec 2011 14:18:16 -0800 Subject: [perl #29070] Add vstring set-magic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some operators, like pp_complement, assign their argument to TARG (which copies vstring magic), modify it in place, and then call set- magic. That’s supposed to work, but vstring magic was remaining as it was, such that ~v7 would still be treated as "v7" by vstring-aware code, even though the resulting string is not "\7". This commit adds vstring set-magic that checks to see whether the pv still matches the vstring. It cannot simply free the vstring magic, as that would prevent $x=v0 from working. --- mg_vtable.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mg_vtable.h') diff --git a/mg_vtable.h b/mg_vtable.h index 2e3ca3522f..12f2fa35f3 100644 --- a/mg_vtable.h +++ b/mg_vtable.h @@ -90,6 +90,7 @@ enum { /* pass one of these to get_vtbl */ want_vtbl_utf8, want_vtbl_uvar, want_vtbl_vec, + want_vtbl_vstring, magic_vtable_max }; @@ -124,7 +125,8 @@ EXTCONST char *PL_magic_vtable_names[magic_vtable_max] = { "taint", "utf8", "uvar", - "vec" + "vec", + "vstring" }; #else EXTCONST char *PL_magic_vtable_names[magic_vtable_max]; @@ -186,7 +188,8 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max] = { { Perl_magic_gettaint, Perl_magic_settaint, 0, 0, 0, 0, 0, 0 }, { 0, Perl_magic_setutf8, 0, 0, 0, 0, 0, 0 }, { Perl_magic_getuvar, Perl_magic_setuvar, 0, 0, 0, 0, 0, 0 }, - { Perl_magic_getvec, Perl_magic_setvec, 0, 0, 0, 0, 0, 0 } + { Perl_magic_getvec, Perl_magic_setvec, 0, 0, 0, 0, 0, 0 }, + { 0, Perl_magic_setvstring, 0, 0, 0, 0, 0, 0 } }; #else EXT_MGVTBL PL_magic_vtables[magic_vtable_max]; @@ -227,5 +230,6 @@ EXT_MGVTBL PL_magic_vtables[magic_vtable_max]; #define PL_vtbl_utf8 PL_magic_vtables[want_vtbl_utf8] #define PL_vtbl_uvar PL_magic_vtables[want_vtbl_uvar] #define PL_vtbl_vec PL_magic_vtables[want_vtbl_vec] +#define PL_vtbl_vstring PL_magic_vtables[want_vtbl_vstring] /* ex: set ro: */ -- cgit v1.2.1