summaryrefslogtreecommitdiff
path: root/hv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-05-26 14:24:31 +0000
committerNicholas Clark <nick@ccl4.org>2005-05-26 14:24:31 +0000
commit7423f6db106ad471398838e82e73b22d8c1e166e (patch)
treeab25b2b670e12e8d4ae54af8c7e216c47ef20c4a /hv.h
parentc4a9c09d5b30a93b6241aff3c9915e33e4e41eeb (diff)
downloadperl-7423f6db106ad471398838e82e73b22d8c1e166e.tar.gz
Store the package name as a shared HEK.
Abolish HvNAME() - as the stored pointer is not a char* you can't set it directly now. Storing a pointer to a HEK tracks the length too, and seems to be faster. p4raw-id: //depot/perl@24584
Diffstat (limited to 'hv.h')
-rw-r--r--hv.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/hv.h b/hv.h
index d53bfaf807..db6ad946d1 100644
--- a/hv.h
+++ b/hv.h
@@ -34,7 +34,7 @@ struct hek {
Don't access this directly.
*/
struct xpvhv_aux {
- char *xhv_name; /* name, if a symbol table */
+ HEK *xhv_name; /* name, if a symbol table */
HE *xhv_eiter; /* current entry of iterator */
I32 xhv_riter; /* current root of iterator */
};
@@ -224,11 +224,13 @@ C<SV*>.
((struct xpvhv_aux*)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_riter : -1)
#define HvEITER_get(hv) (((XPVHV *)SvANY(hv))->xhv_aux ? \
((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_eiter : 0)
-#define HvNAME(hv) (*Perl_hv_name_p(aTHX_ (HV*)hv))
+#define HvNAME(hv) HvNAME_get(hv)
/* FIXME - all of these should use a UTF8 aware API, which should also involve
getting the length. */
#define HvNAME_get(hv) (((XPVHV *)SvANY(hv))->xhv_aux ? \
- ((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name : 0)
+ (((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) ? HEK_KEY(((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) : 0 : 0)
+#define HvNAMELEN_get(hv) (((XPVHV *)SvANY(hv))->xhv_aux ? \
+ (((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) ? HEK_LEN(((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) : 0 : 0)
/* the number of keys (including any placeholers) */
#define XHvTOTALKEYS(xhv) ((xhv)->xhv_keys)