diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-23 14:18:16 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-23 14:45:55 -0800 |
commit | 1e6bda93199bc72086fd20f4dab89d46590b379a (patch) | |
tree | d3c9063779f46754f059847ce4708cd2dc3dad15 /mg_vtable.h | |
parent | f0cd42383d11de42b3b8137c27c960b257975418 (diff) | |
download | perl-1e6bda93199bc72086fd20f4dab89d46590b379a.tar.gz |
[perl #29070] Add vstring set-magic
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.
Diffstat (limited to 'mg_vtable.h')
-rw-r--r-- | mg_vtable.h | 8 |
1 files changed, 6 insertions, 2 deletions
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: */ |