summaryrefslogtreecommitdiff
path: root/pad.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-22 16:33:06 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-22 16:33:06 -0700
commit97dad6bd61c5edcb26f3914032533009ea53c245 (patch)
tree08e8eabc140d1e2652c8b382edee918b0b705ae8 /pad.h
parentc44737a23e8184d44143ac18e378a12912e6e9e8 (diff)
downloadperl-97dad6bd61c5edcb26f3914032533009ea53c245.tar.gz
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.
Diffstat (limited to 'pad.h')
-rw-r--r--pad.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/pad.h b/pad.h
index 30895c9ad6..c852e15031 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<pn>. 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)