From: Father Chrysostomos Date: Wed, 22 Aug 2012 23:33:06 +0000 (-0700) Subject: pad.h: PADNAME_SV X-Git-Tag: v5.17.4~312 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/97dad6bd61c5edcb26f3914032533009ea53c245 pad.h: PADNAME_SV If CPAN modules should not assume that pad names are SVs, we need to provide a better way than newSVpvn(PADNAME_PV(pn),PADNAME_LEN(pn)) to get an SV out of it, as, knowing that pad names are just SVs, the core can do it more efficiently by simply returning the pad name itself. --- diff --git a/pad.h b/pad.h index 30895c9..c852e15 100644 --- a/pad.h +++ b/pad.h @@ -215,6 +215,10 @@ The length of the name. =for apidoc Amx|bool|PADNAME_UTF8|PADNAME pn Whether PADNAME_PV is in UTF8. +=for apidoc Amx|SV *|PADNAME_SV|PADNAME pn +Returns the pad name as an SV. This is currently just C. It will +begin returning a new mortal SV if pad names ever stop being SVs. + =for apidoc m|bool|PADNAME_isOUR|PADNAME pn Whether this is an "our" variable. @@ -285,6 +289,7 @@ Restore the old pad saved into the local variable opad by PAD_SAVE_LOCAL() #define PADNAME_PV(pn) SvPV_nolen(pn) #define PADNAME_LEN(pn) SvCUR(pn) #define PADNAME_UTF8(pn) !!SvUTF8(pn) +#define PADNAME_SV(pn) pn #define PADNAME_isOUR(pn) !!SvPAD_OUR(pn) #define PADNAME_OURSTASH SvOURSTASH(pn) #define PADNAME_OUTER !!SvFAKE(pn)