summaryrefslogtreecommitdiff
path: root/hv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-20 16:44:24 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-20 16:44:24 +0000
commita038e571a304dfaab880bf2795d3d9b945b09505 (patch)
tree567c6e0a04c7adbed1b8ec643d2b516bf147402e /hv.h
parent3c84c864231398acf151e374b509e7baf61d7cef (diff)
downloadperl-a038e571a304dfaab880bf2795d3d9b945b09505.tar.gz
Add a new function Perl_hv_common_key_len(), which contains the
manipulations to convert negative lengths to positive length + UTF-8 flag. hv_delete(), hv_exists(), hv_fetch(), hv_store() and hv_store_flags() all become mathoms. The macros hv_fetchs() and hv_stores() call hv_common() directly. p4raw-id: //depot/perl@31931
Diffstat (limited to 'hv.h')
-rw-r--r--hv.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/hv.h b/hv.h
index 8ca69fc1aa..163c660db6 100644
--- a/hv.h
+++ b/hv.h
@@ -426,6 +426,29 @@ C<SV*>.
((SV *) hv_common((zlonk), (awk), NULL, 0, 0, (touche) | HV_DELETE, \
NULL, (zgruppp)))
+#define hv_store_flags(urkk, zamm, clunk, thwape, sploosh, eee_yow) \
+ ((SV**) hv_common((urkk), NULL, (zamm), (clunk), (eee_yow), \
+ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), (thwape), \
+ (sploosh)))
+
+#define hv_store(urkk, zamm, clunk, thwape, sploosh) \
+ ((SV**) hv_common_key_len((urkk), (zamm), (clunk), \
+ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), \
+ (thwape), (sploosh)))
+
+#define hv_exists(urkk, zamm, clunk) \
+ (hv_common_key_len((urkk), (zamm), (clunk), HV_FETCH_ISEXISTS, NULL, 0) \
+ ? TRUE : FALSE)
+
+#define hv_fetch(urkk, zamm, clunk, pam) \
+ ((SV**) hv_common_key_len((urkk), (zamm), (clunk), (pam) \
+ ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \
+ : HV_FETCH_JUST_SV, NULL, 0))
+
+#define hv_delete(urkk, zamm, clunk, pam) \
+ ((SV*) hv_common_key_len((urkk), (zamm), (clunk), \
+ (pam) | HV_DELETE, NULL, 0))
+
/* This refcounted he structure is used for storing the hints used for lexical
pragmas. Without threads, it's basically struct he + refcount.
With threads, life gets more complex as the structure needs to be shared