This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
S_share_hek_flags can revert to returning a HEK
[perl5.git] / hv.c
diff --git a/hv.c b/hv.c
index 68a9597..3d2e589 100644 (file)
--- 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 *