diff options
author | Nicholas Clark <nick@ccl4.org> | 2003-12-14 18:35:15 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2003-12-14 18:35:15 +0000 |
commit | dcf933a4be50d8c2632709d99162e1b812424330 (patch) | |
tree | a045fc24cc691014722a697577ccc5625d9391d3 /hv.c | |
parent | 086cb327289a4871101f072239f753777e628728 (diff) | |
download | perl-dcf933a4be50d8c2632709d99162e1b812424330.tar.gz |
S_save_hek_flags should honour the "free" flag.
Ought to mask the flag bits that shouldn't be stored.
p4raw-id: //depot/perl@21907
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -80,6 +80,7 @@ S_more_he(pTHX) STATIC HEK * S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags) { + int flags_masked = flags & HVhek_MASK; char *k; register HEK *hek; @@ -89,7 +90,10 @@ S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags) HEK_KEY(hek)[len] = 0; HEK_LEN(hek) = len; HEK_HASH(hek) = hash; - HEK_FLAGS(hek) = (unsigned char)flags; + HEK_FLAGS(hek) = (unsigned char)flags_masked; + + if (flags & HVhek_FREEKEY) + Safefree(str); return hek; } @@ -2083,7 +2087,7 @@ S_share_hek_flags(pTHX_ const char *str, I32 len, register U32 hash, int flags) } if (!found) { entry = new_HE(); - HeKEY_hek(entry) = save_hek_flags(str, len, hash, flags); + HeKEY_hek(entry) = save_hek_flags(str, len, hash, flags_masked); HeVAL(entry) = Nullsv; HeNEXT(entry) = *oentry; *oentry = entry; |