diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-24 00:00:51 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-30 11:48:37 -0800 |
commit | 2502ffdfca07fac6972c9b2da7ae160d011c2877 (patch) | |
tree | 36550c7148dabae1b2a8fe766a5b64e523657c6f /pad.h | |
parent | 09c676d973b724f9d8bc07dbb1b115dd8920d5f5 (diff) | |
download | perl-2502ffdfca07fac6972c9b2da7ae160d011c2877.tar.gz |
Make pad names always UTF8
Prior to 5.16, pad names never used the UTF8 flag, and all non-ASCII
pad names were in UTF8. Because the latter was consistently true,
everything just worked anyway.
In 5.16, UTF8 handling was done ‘properly’, so that non-ASCII UTF8
strings were always accompanied by the UTF8 flag.
Now, it is still the case that the only non-ASCII names to make their
way into pad name code are in UTF8. Since ASCII is a subset of UTF8,
we effectively *always* have UTF8 pad names. So the flag handling is
actually redundant.
If we just assume that all pad names are UTF8 (which is true), then
we don’t need to bother with the flag checking. There is actually
no reason why we should have two different encodings for storing
pad names.
So this commit enforces what has always been the case and removes the
extra code for converting between Latin-1 and UTF8. Nothing on CPAN
is using the UTF8 flag with pads, so nothing should break. In fact,
we never documented padadd_UTF8_NAME.
Diffstat (limited to 'pad.h')
-rw-r--r-- | pad.h | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -143,7 +143,6 @@ typedef enum { #define padadd_NO_DUP_CHECK 0x04 /* skip warning on dups. */ #define padadd_STALEOK 0x08 /* allow stale lexical in active * sub, but only one level up */ -#define padadd_UTF8_NAME SVf_UTF8 /* name is UTF-8 encoded. */ /* ASSERT_CURPAD_LEGAL and ASSERT_CURPAD_ACTIVE respectively determine * whether PL_comppad and PL_curpad are consistent and whether they have @@ -234,7 +233,7 @@ GV slot. The length of the name. =for apidoc Amx|bool|PadnameUTF8|PADNAME pn -Whether PadnamePV is in UTF8. +Whether PadnamePV is in UTF8. Currently, this is always true. =for apidoc Amx|SV *|PadnameSV|PADNAME pn Returns the pad name as an SV. This is currently just C<pn>. It will @@ -315,7 +314,7 @@ Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL() #define PadnamePV(pn) (SvPOKp(pn) ? SvPVX_const(pn) : NULL) #define PadnameLEN(pn) ((SV*)(pn) == &PL_sv_undef ? 0 : SvCUR(pn)) -#define PadnameUTF8(pn) !!SvUTF8(pn) +#define PadnameUTF8(pn) (assert_(SvUTF8(pn)) 1) #define PadnameSV(pn) pn #define PadnameIsOUR(pn) !!SvPAD_OUR(pn) #define PadnameOURSTASH(pn) SvOURSTASH(pn) |