summaryrefslogtreecommitdiff
path: root/hv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-07-20 20:05:44 +0000
committerNicholas Clark <nick@ccl4.org>2021-07-26 07:06:00 +0000
commit5ebe3ee8a2e8df14624495256026a546dbf8c1dc (patch)
tree428ae8a07eda7f01ec8814510cc9edb67b72eca7 /hv.h
parentbffed14d6aeedc70a2f799ef7c8fe1f5d608eb52 (diff)
downloadperl-5ebe3ee8a2e8df14624495256026a546dbf8c1dc.tar.gz
Convert code in mro_core.c to use hv_*hek() APIs where possible.
Add a macro hv_existshek() to implement exists. The HEK-based macros are more efficient wrappers of hv_common() than the string/length/flags macros because they also pass in the pre-computed hash value (from the HEK). This avoids hv_common() needing to recalculate it.
Diffstat (limited to 'hv.h')
-rw-r--r--hv.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/hv.h b/hv.h
index 119cf8c966..a43b9611bb 100644
--- a/hv.h
+++ b/hv.h
@@ -533,6 +533,9 @@ See L</hv_fill>.
# define hv_deletehek(hv, hek, flags) \
hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \
(flags)|HV_DELETE, NULL, HEK_HASH(hek))
+#define hv_existshek(hv, hek) \
+ cBOOL(hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \
+ HV_FETCH_ISEXISTS, NULL, HEK_HASH(hek)))
#endif
/* This refcounted he structure is used for storing the hints used for lexical