summaryrefslogtreecommitdiff
path: root/handy.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 /handy.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 'handy.h')
-rw-r--r--handy.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/handy.h b/handy.h
index 2f76f0afc3..c0cd4c8d76 100644
--- a/handy.h
+++ b/handy.h
@@ -290,8 +290,14 @@ and omits the hash parameter.
#define savepvs(str) Perl_savepvn(aTHX_ STR_WITH_LEN(str))
#define gv_stashpvs(str, create) Perl_gv_stashpvn(aTHX_ STR_WITH_LEN(str), create)
#define gv_fetchpvs(namebeg, add, sv_type) Perl_gv_fetchpvn_flags(aTHX_ STR_WITH_LEN(namebeg), add, sv_type)
-#define hv_fetchs(hv,key,lval) Perl_hv_fetch(aTHX_ hv, STR_WITH_LEN(key), lval)
-#define hv_stores(hv,key,val) Perl_hv_store(aTHX_ hv, STR_WITH_LEN(key), val, 0)
+#define hv_fetchs(hv,key,lval) \
+ ((SV **)Perl_hv_common(aTHX_ (hv), NULL, STR_WITH_LEN(key), 0, \
+ (lval) ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \
+ : HV_FETCH_JUST_SV, NULL, 0))
+
+#define hv_stores(hv,key,val) \
+ ((SV **)Perl_hv_common(aTHX_ (hv), NULL, STR_WITH_LEN(key), 0, \
+ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), (val), 0))
/*