summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-13 09:43:18 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-13 09:43:18 +0000
commit6e838c7028a89a713e974e5b08797f5fb2193532 (patch)
tree0a5ccce6360b1c44b73f8cd87bbe95d96e74ca1f /hv.c
parent4662c7508c20ff119872526a6072e2d64a5bb632 (diff)
downloadperl-6e838c7028a89a713e974e5b08797f5fb2193532.tar.gz
S_share_hek_flags can revert to returning a HEK
p4raw-id: //depot/perl@24819
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/hv.c b/hv.c
index 68a95976ec..3d2e5891e9 100644
--- a/hv.c
+++ b/hv.c
@@ -135,8 +135,8 @@ Perl_hek_dup(pTHX_ HEK *source, CLONE_PARAMS* param)
}
else {
shared
- = HeKEY_hek(share_hek_flags(HEK_KEY(source), HEK_LEN(source),
- HEK_HASH(source), HEK_FLAGS(source)));
+ = share_hek_flags(HEK_KEY(source), HEK_LEN(source),
+ HEK_HASH(source), HEK_FLAGS(source));
ptr_table_store(PL_ptr_table, source, shared);
}
return shared;
@@ -177,9 +177,8 @@ Perl_he_dup(pTHX_ HE *e, bool shared, CLONE_PARAMS* param)
}
else {
shared
- = HeKEY_hek(share_hek_flags(HEK_KEY(source), HEK_LEN(source),
- HEK_HASH(source),
- HEK_FLAGS(source)));
+ = share_hek_flags(HEK_KEY(source), HEK_LEN(source),
+ HEK_HASH(source), HEK_FLAGS(source));
ptr_table_store(PL_ptr_table, source, shared);
}
HeKEY_hek(ret) = shared;
@@ -688,8 +687,8 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
/* Need to swap the key we have for a key with the flags we
need. As keys are shared we can't just write to the
flag, so we share the new one, unshare the old one. */
- HEK *new_hek = HeKEY_hek(share_hek_flags(key, klen, hash,
- masked_flags));
+ HEK *new_hek = share_hek_flags(key, klen, hash,
+ masked_flags);
unshare_hek (HeKEY_hek(entry));
HeKEY_hek(entry) = new_hek;
}
@@ -793,7 +792,7 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
/* share_hek_flags will do the free for us. This might be considered
bad API design. */
if (HvSHAREKEYS(hv))
- HeKEY_hek(entry) = HeKEY_hek(share_hek_flags(key, klen, hash, flags));
+ HeKEY_hek(entry) = share_hek_flags(key, klen, hash, flags);
else /* gotta do the real thing */
HeKEY_hek(entry) = save_hek_flags(key, klen, hash, flags);
HeVAL(entry) = val;
@@ -1420,7 +1419,7 @@ Perl_newHVhv(pTHX_ HV *ohv)
ent = new_HE();
HeVAL(ent) = newSVsv(HeVAL(oent));
HeKEY_hek(ent)
- = shared ? HeKEY_hek(share_hek_flags(key, len, hash, flags))
+ = shared ? share_hek_flags(key, len, hash, flags)
: save_hek_flags(key, len, hash, flags);
if (prev)
HeNEXT(prev) = ent;
@@ -2279,10 +2278,10 @@ Perl_share_hek(pTHX_ const char *str, I32 len, register U32 hash)
flags |= HVhek_WASUTF8 | HVhek_FREEKEY;
}
- return HeKEY_hek(share_hek_flags (str, len, hash, flags));
+ return share_hek_flags (str, len, hash, flags);
}
-STATIC HE *
+STATIC HEK *
S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
{
register XPVHV* xhv;
@@ -2363,7 +2362,7 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags)
if (flags & HVhek_FREEKEY)
Safefree(str);
- return entry;
+ return HeKEY_hek(entry);
}
I32 *