Duplicate 19423 (pathological hashes too easy) into hv_store_ent
Nicholas Clark [Tue, 14 Oct 2003 18:45:39 +0000 (18:45 +0000)]
(the routine used by perl level HV operations)

p4raw-id: //depot/perl@21446

hv.c

diff --git a/hv.c b/hv.c
index 63e112a..5e2a385 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -871,8 +871,8 @@ Perl_hv_store_ent(pTHX_ HV *hv, SV *keysv, SV *val, U32 hash)
     xhv->xhv_keys++; /* HvKEYS(hv)++ */
     if (i) {                           /* initial entry? */
        xhv->xhv_fill++; /* HvFILL(hv)++ */
-       if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */)
-           hsplit(hv);
+    } else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
+       hsplit(hv);
     }
 
     return entry;