summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/Hash/Util/FieldHash/FieldHash.xs9
-rw-r--r--hv.c7
-rw-r--r--hv.h9
3 files changed, 11 insertions, 14 deletions
diff --git a/ext/Hash/Util/FieldHash/FieldHash.xs b/ext/Hash/Util/FieldHash/FieldHash.xs
index a749fc763c..25d06f562b 100644
--- a/ext/Hash/Util/FieldHash/FieldHash.xs
+++ b/ext/Hash/Util/FieldHash/FieldHash.xs
@@ -177,14 +177,7 @@ void HUF_mark_field(SV* trigger, SV* field) {
hv_store_ent(field_tab, field_id, field_ref, 0);
}
-/* These constants are not in the API. If they ever change in hv.c this code
- * must be updated */
-#define HV_FETCH_ISSTORE 0x01
-#define HV_FETCH_ISEXISTS 0x02
-#define HV_FETCH_LVALUE 0x04
-#define HV_FETCH_JUST_SV 0x08
-
-#define HUF_WOULD_CREATE_KEY(x) ((x) != -1 && ((x) & (HV_FETCH_ISSTORE | HV_FETCH_LVALUE)))
+#define HUF_WOULD_CREATE_KEY(x) ((x) != HV_DELETE && ((x) & (HV_FETCH_ISSTORE | HV_FETCH_LVALUE)))
/* The key exchange function. It communicates with S_hv_magic_uvar_xkey
* in hv.c */
diff --git a/hv.c b/hv.c
index 79702fd98e..1bde70e3cd 100644
--- a/hv.c
+++ b/hv.c
@@ -216,11 +216,6 @@ S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen,
/* (klen == HEf_SVKEY) is special for MAGICAL hv entries, meaning key slot
* contains an SV* */
-#define HV_FETCH_ISSTORE 0x01
-#define HV_FETCH_ISEXISTS 0x02
-#define HV_FETCH_LVALUE 0x04
-#define HV_FETCH_JUST_SV 0x08
-
/*
=for apidoc hv_store
@@ -963,7 +958,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
if (keysv) {
if (SvSMAGICAL(hv) && SvGMAGICAL(hv))
- keysv = hv_magic_uvar_xkey(hv, keysv, -1);
+ keysv = hv_magic_uvar_xkey(hv, keysv, HV_DELETE);
if (k_flags & HVhek_FREEKEY)
Safefree(key);
key = SvPV_const(keysv, klen);
diff --git a/hv.h b/hv.h
index 7047ea0226..a82958f7a8 100644
--- a/hv.h
+++ b/hv.h
@@ -480,6 +480,15 @@ struct refcounted_he {
# define HINTS_REFCNT_TERM NOOP
#endif
+/* Hash actions
+ * Passed in PERL_MAGIC_uvar calls
+ */
+#define HV_DELETE -1
+#define HV_FETCH_ISSTORE 0x01
+#define HV_FETCH_ISEXISTS 0x02
+#define HV_FETCH_LVALUE 0x04
+#define HV_FETCH_JUST_SV 0x08
+
/*
* Local variables:
* c-indentation-style: bsd