From: Jerry D. Hedden Date: Tue, 24 Apr 2007 10:35:43 +0000 (-0400) Subject: Move hash action constants to hv.h X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=324a0d1887cfcef6494645efbaf97082c32ae679;p=p5sagit%2Fp5-mst-13.2.git Move hash action constants to hv.h From: "Jerry D. Hedden" Message-ID: <1ff86f510704240735t50cfc159g59b55726ac5ac64b@mail.gmail.com> p4raw-id: //depot/perl@31064 --- diff --git a/ext/Hash/Util/FieldHash/FieldHash.xs b/ext/Hash/Util/FieldHash/FieldHash.xs index a749fc7..25d06f5 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 79702fd..1bde70e 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 7047ea0..a82958f 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