X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/b2c03ebdf370f093a95cbbc154411f05c13e5913..fcfb9f49f0bdeeefc0c369bbb92e2cc159e06676:/hv.h?ds=sidebyside diff --git a/hv.h b/hv.h index 4eafcc6..77c39d9 100644 --- a/hv.h +++ b/hv.h @@ -175,6 +175,12 @@ Null HV pointer. Returns the package name of a stash, or NULL if C isn't a stash. See C, C. +=for apidoc Am|STRLEN|HvNAMELEN|HV *stash +Returns the length of the stash's name. + +=for apidoc Am|unsigned char|HvNAMEUTF8|HV *stash +Returns true if the name is in UTF8 encoding. + =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 @@ -183,6 +189,12 @@ 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|STRLEN|HvENAMELEN|HV *stash +Returns the length of the stash's effective name. + +=for apidoc Am|unsigned char|HvENAMEUTF8|HV *stash +Returns true if the effective name is in UTF8 encoding. + =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 @@ -268,8 +280,6 @@ C. ? HvAUX(hv)->xhv_mro_meta \ : Perl_mro_meta_init(aTHX_ hv)) -/* FIXME - all of these should use a UTF8 aware API, which should also involve - getting the length. */ #define HvNAME_HEK_NN(hv) \ ( \ HvAUX(hv)->xhv_name_count \ @@ -298,13 +308,13 @@ C. #define HvENAME_HEK(hv) \ (SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name ? HvENAME_HEK_NN(hv) : NULL) #define HvENAME_get(hv) \ - ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvENAME_HEK_NN(hv)) \ + ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ ? HEK_KEY(HvENAME_HEK_NN(hv)) : NULL) #define HvENAMELEN_get(hv) \ - ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvENAME_HEK_NN(hv)) \ + ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ ? HEK_LEN(HvENAME_HEK_NN(hv)) : 0) #define HvENAMEUTF8(hv) \ - ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvENAME_HEK_NN(hv)) \ + ((SvOOK(hv) && HvAUX(hv)->xhv_name_u.xhvnameu_name && HvAUX(hv)->xhv_name_count != -1) \ ? HEK_UTF8(HvENAME_HEK_NN(hv)) : 0) /* the number of keys (including any placeholders) */ @@ -442,9 +452,8 @@ C. #define hv_magic(hv, gv, how) sv_magic(MUTABLE_SV(hv), MUTABLE_SV(gv), how, NULL, 0) #define hv_undef(hv) Perl_hv_undef_flags(aTHX_ hv, 0) -/* available as a function in hv.c */ -#define Perl_sharepvn(sv, len, hash) HEK_KEY(share_hek(sv, len, hash)) -#define sharepvn(sv, len, hash) Perl_sharepvn(sv, len, hash) +#define Perl_sharepvn(pv, len, hash) HEK_KEY(share_hek(pv, len, hash)) +#define sharepvn(pv, len, hash) Perl_sharepvn(pv, len, hash) #define share_hek_hek(hek) \ (++(((struct shared_he *)(((char *)hek) \ @@ -500,6 +509,9 @@ struct refcounted_he; /* flags for the refcounted_he API */ #define REFCOUNTED_HE_KEY_UTF8 0x00000001 +#ifdef PERL_CORE +# define REFCOUNTED_HE_EXISTS 0x00000002 +#endif #ifdef PERL_CORE @@ -614,8 +626,8 @@ Creates a new HV. The reference count is set to 1. * Local variables: * c-indentation-style: bsd * c-basic-offset: 4 - * indent-tabs-mode: t + * indent-tabs-mode: nil * End: * - * ex: set ts=8 sts=4 sw=4 noet: + * ex: set ts=8 sts=4 sw=4 et: */