From 9de10d5cc42400cb24ab416f95826fe4d2a152a6 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 29 Mar 2011 13:38:13 +0100 Subject: [PATCH] Eliminate C variables unused since 4d0fbddde6c5dcb9 refactored HvFILL() 3 functions had C variables previously used to track whether the number of hash chains have any entries. 4d0fbddde6c5dcb9 refactored the hash implementation to calculated this on demand, instead of tracking changes to it on hash updates. That change missed eliminating those variables, as gcc prior to 4.6.0 didn't actually warn that they weren't used, because (technically) they aren't unused - they are assigned to, but never read. gcc (at least 4.3.2 and 4.6.0) generates identical object code with/without this change, implying that its optimiser correctly eliminates the code. Other optimisers may be similar, in which case there's no runtime saving from this change. --- hv.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hv.c b/hv.c index 56598d7..5e96013 100644 --- a/hv.c +++ b/hv.c @@ -904,7 +904,6 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, register XPVHV* xhv; register HE *entry; register HE **oentry; - HE *const *first_entry; bool is_utf8 = (k_flags & HVhek_UTF8) ? TRUE : FALSE; int masked_flags; @@ -983,7 +982,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, masked_flags = (k_flags & HVhek_MASK); - first_entry = oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)]; + oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)]; entry = *oentry; for (; entry; oentry = &HeNEXT(entry), entry = *oentry) { SV *sv; @@ -1610,7 +1609,6 @@ S_clear_placeholders(pTHX_ HV *hv, U32 items) i = HvMAX(hv); do { /* Loop down the linked list heads */ - bool first = TRUE; HE **oentry = &(HvARRAY(hv))[i]; HE *entry; @@ -1632,7 +1630,6 @@ S_clear_placeholders(pTHX_ HV *hv, U32 items) } } else { oentry = &HeNEXT(entry); - first = FALSE; } } } while (--i >= 0); @@ -2636,7 +2633,6 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash) register XPVHV* xhv; HE *entry; register HE **oentry; - HE **first; bool is_utf8 = FALSE; int k_flags = 0; const char * const save = str; @@ -2677,7 +2673,7 @@ S_unshare_hek_or_pvn(pTHX_ const HEK *hek, const char *str, I32 len, U32 hash) } */ xhv = (XPVHV*)SvANY(PL_strtab); /* assert(xhv_array != 0) */ - first = oentry = &(HvARRAY(PL_strtab))[hash & (I32) HvMAX(PL_strtab)]; + oentry = &(HvARRAY(PL_strtab))[hash & (I32) HvMAX(PL_strtab)]; if (he) { const HE *const he_he = &(he->shared_he_he); for (entry = *oentry; entry; oentry = &HeNEXT(entry), entry = *oentry) { -- 2.7.4