From bc56db2a697ebe59892fabdcfa5aa910ed4f2885 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 29 Oct 2010 08:59:33 -0700 Subject: [PATCH] Add HvENAME Add HvENAME as an alias for HvENAME_get and make it public. This is now the preferred name for use in isa caches. --- hv.h | 9 +++++++++ pod/perlmroapi.pod | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hv.h b/hv.h index 655be9a..81786a6 100644 --- a/hv.h +++ b/hv.h @@ -179,6 +179,14 @@ Null HV pointer. Returns the package name of a stash, or NULL if C isn't a stash. See C, C. +=for apidoc Am|char*|HvENAME|HV* stash +Returns the effective name of a stash, or NULL if there is none. The +effective name represents a location in the symbol table where this stash +resides. It is updated automatically when packages are aliased or deleted. +A stash that is no longer in the symbol table has no effective name. This +name is preferable to C for use in MRO linearisations and isa +caches. + =for apidoc Am|void*|HeKEY|HE* he Returns the actual pointer stored in the key slot of the hash entry. The pointer may be either C or C, depending on the value of @@ -254,6 +262,7 @@ C. #define HvRITER_get(hv) (SvOOK(hv) ? HvAUX(hv)->xhv_riter : -1) #define HvEITER_get(hv) (SvOOK(hv) ? HvAUX(hv)->xhv_eiter : NULL) #define HvNAME(hv) HvNAME_get(hv) +#define HvENAME(hv) HvENAME_get(hv) /* Checking that hv is a valid package stash is the caller's responsibility */ diff --git a/pod/perlmroapi.pod b/pod/perlmroapi.pod index 2200bec..f010b75 100644 --- a/pod/perlmroapi.pod +++ b/pod/perlmroapi.pod @@ -54,11 +54,13 @@ function - the parameter is provided to allow your implementation to track depth if it needs to recurse. The function should return a reference to an array containing the parent -classes in order. The caller is responsible for incrementing the reference -count if it wants to keep the structure. Hence if you have created a -temporary value that you keep no pointer to, C to ensure that -it is disposed of correctly. If you have cached your return value, then -return a pointer to it without changing the reference count. +classes in order. The names of the classes should be the result of calling +C on the stash. The caller is responsible for incrementing the +reference count of the array returned if it wants to keep the structure. +Hence, if you have created a temporary value that you keep no pointer to, +C to ensure that it is disposed of correctly. If you have +cached your return value, then return a pointer to it without changing the +reference count. =head1 Caching -- 2.7.4