#define hv_exists_ent Perl_hv_exists_ent
#define hv_fetch Perl_hv_fetch
#define hv_fetch_ent Perl_hv_fetch_ent
+#define hv_common Perl_hv_common
#define hv_free_ent Perl_hv_free_ent
#define hv_iterinit Perl_hv_iterinit
#define hv_iterkey Perl_hv_iterkey
#define hv_notallowed S_hv_notallowed
#define hv_auxinit S_hv_auxinit
#define hv_delete_common S_hv_delete_common
-#define hv_fetch_common S_hv_fetch_common
#define clear_placeholders S_clear_placeholders
#define refcounted_he_value S_refcounted_he_value
#endif
#define hv_exists_ent(a,b,c) Perl_hv_exists_ent(aTHX_ a,b,c)
#define hv_fetch(a,b,c,d) Perl_hv_fetch(aTHX_ a,b,c,d)
#define hv_fetch_ent(a,b,c,d) Perl_hv_fetch_ent(aTHX_ a,b,c,d)
+#define hv_common(a,b,c,d,e,f,g,h) Perl_hv_common(aTHX_ a,b,c,d,e,f,g,h)
#define hv_free_ent(a,b) Perl_hv_free_ent(aTHX_ a,b)
#define hv_iterinit(a) Perl_hv_iterinit(aTHX_ a)
#define hv_iterkey(a,b) Perl_hv_iterkey(aTHX_ a,b)
#define hv_notallowed(a,b,c,d) S_hv_notallowed(aTHX_ a,b,c,d)
#define hv_auxinit S_hv_auxinit
#define hv_delete_common(a,b,c,d,e,f,g) S_hv_delete_common(aTHX_ a,b,c,d,e,f,g)
-#define hv_fetch_common(a,b,c,d,e,f,g,h) S_hv_fetch_common(aTHX_ a,b,c,d,e,f,g,h)
#define clear_placeholders(a,b) S_clear_placeholders(aTHX_ a,b)
#define refcounted_he_value(a) S_refcounted_he_value(aTHX_ a)
#endif
klen = klen_i32;
flags = 0;
}
- hek = hv_fetch_common (hv, NULL, key, klen, flags,
- (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
+ hek = hv_common(hv, NULL, key, klen, flags,
+ (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
return hek ? &HeVAL(hek) : NULL;
}
Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val,
register U32 hash, int flags)
{
- HE * const hek = hv_fetch_common (hv, NULL, key, klen, flags,
+ HE * const hek = hv_common(hv, NULL, key, klen, flags,
(HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), val, hash);
return hek ? &HeVAL(hek) : NULL;
}
HE *
Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash)
{
- return hv_fetch_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISSTORE, val, hash);
+ return hv_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISSTORE, val, hash);
}
/*
klen = klen_i32;
flags = 0;
}
- return hv_fetch_common(hv, NULL, key, klen, flags, HV_FETCH_ISEXISTS, 0, 0)
+ return hv_common(hv, NULL, key, klen, flags, HV_FETCH_ISEXISTS, 0, 0)
? TRUE : FALSE;
}
klen = klen_i32;
flags = 0;
}
- hek = hv_fetch_common (hv, NULL, key, klen, flags,
- lval ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) : HV_FETCH_JUST_SV,
- NULL, 0);
+ hek = hv_common(hv, NULL, key, klen, flags, lval
+ ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) : HV_FETCH_JUST_SV,
+ NULL, 0);
return hek ? &HeVAL(hek) : NULL;
}
bool
Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash)
{
- return hv_fetch_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISEXISTS, 0, hash)
+ return hv_common(hv, keysv, NULL, 0, 0, HV_FETCH_ISEXISTS, 0, hash)
? TRUE : FALSE;
}
HE *
Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, register U32 hash)
{
- return hv_fetch_common(hv, keysv, NULL, 0, 0,
- (lval ? HV_FETCH_LVALUE : 0), NULL, hash);
+ return hv_common(hv, keysv, NULL, 0, 0,
+ (lval ? HV_FETCH_LVALUE : 0), NULL, hash);
}
-STATIC HE *
-S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
- int flags, int action, SV *val, register U32 hash)
+HE *
+Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
+ int flags, int action, SV *val, register U32 hash)
{
dVAR;
XPVHV* xhv;
const char * const nkey = strupr(savepvn(key,klen));
/* Note that this fetch is for nkey (the uppercased
key) whereas the store is for key (the original) */
- entry = hv_fetch_common(hv, NULL, nkey, klen,
- HVhek_FREEKEY, /* free nkey */
- 0 /* non-LVAL fetch */
- | HV_DISABLE_UVAR_XKEY,
- NULL /* no value */,
- 0 /* compute hash */);
+ entry = hv_common(hv, NULL, nkey, klen,
+ HVhek_FREEKEY, /* free nkey */
+ 0 /* non-LVAL fetch */
+ | HV_DISABLE_UVAR_XKEY,
+ NULL /* no value */,
+ 0 /* compute hash */);
if (!entry && (action & HV_FETCH_LVALUE)) {
/* This call will free key if necessary.
Do it this way to encourage compiler to tail
call optimise. */
- entry = hv_fetch_common(hv, keysv, key, klen,
- flags,
- HV_FETCH_ISSTORE
- | HV_DISABLE_UVAR_XKEY,
- newSV(0), hash);
+ entry = hv_common(hv, keysv, key, klen,
+ flags,
+ HV_FETCH_ISSTORE
+ | HV_DISABLE_UVAR_XKEY,
+ newSV(0), hash);
} else {
if (flags & HVhek_FREEKEY)
Safefree(key);
if (env) {
sv = newSVpvn(env,len);
SvTAINTED_on(sv);
- return hv_fetch_common(hv, keysv, key, klen, flags,
- HV_FETCH_ISSTORE|HV_DISABLE_UVAR_XKEY, sv,
- hash);
+ return hv_common(hv, keysv, key, klen, flags,
+ HV_FETCH_ISSTORE|HV_DISABLE_UVAR_XKEY, sv, hash);
}
}
#endif
However, as we replace the original key with the converted
key, this would result in a double conversion, which would show
up as a bug if the conversion routine is not idempotent. */
- return hv_fetch_common(hv, keysv, key, klen, flags,
- HV_FETCH_ISSTORE|HV_DISABLE_UVAR_XKEY, val,
- hash);
+ return hv_common(hv, keysv, key, klen, flags,
+ HV_FETCH_ISSTORE|HV_DISABLE_UVAR_XKEY, val, hash);
/* XXX Surely that could leak if the fetch-was-store fails?
Just like the hv_fetch. */
}
klen = klen_i32;
k_flags = 0;
}
- return (SV *) hv_fetch_common(hv, NULL, key, klen, k_flags,
- flags | HV_DELETE, NULL, 0);
+ return (SV *) hv_common(hv, NULL, key, klen, k_flags, flags | HV_DELETE,
+ NULL, 0);
}
/*
SV *
Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash)
{
- return (SV *) hv_fetch_common(hv, keysv, NULL, 0, 0, flags | HV_DELETE,
- NULL, hash);
+ return (SV *) hv_common(hv, keysv, NULL, 0, 0, flags | HV_DELETE, NULL,
+ hash);
}
STATIC SV *
if (needs_copy) {
SV *sv;
- entry = hv_fetch_common(hv, keysv, key, klen,
- k_flags & ~HVhek_FREEKEY,
- HV_FETCH_LVALUE|HV_DISABLE_UVAR_XKEY,
- NULL, hash);
+ entry = hv_common(hv, keysv, key, klen, k_flags & ~HVhek_FREEKEY,
+ HV_FETCH_LVALUE|HV_DISABLE_UVAR_XKEY, NULL,
+ hash);
sv = entry ? HeVAL(entry) : NULL;
if (sv) {
if (SvMAGICAL(sv)) {