From a038e571a304dfaab880bf2795d3d9b945b09505 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 20 Sep 2007 16:44:24 +0000 Subject: 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 --- hv.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'hv.h') diff --git a/hv.h b/hv.h index 8ca69fc1aa..163c660db6 100644 --- a/hv.h +++ b/hv.h @@ -426,6 +426,29 @@ C. ((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 -- cgit v1.2.1