]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
hashtab.c (htab_traverse): Don't call htab_expand for nearly empty hashtabs with...
authorJakub Jelinek <jakub@redhat.com>
Sun, 21 Jun 2009 09:37:31 +0000 (11:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 21 Jun 2009 09:37:31 +0000 (11:37 +0200)
* hashtab.c (htab_traverse): Don't call htab_expand for
nearly empty hashtabs with sizes 7, 13 or 31.

From-SVN: r148759

libiberty/ChangeLog
libiberty/hashtab.c

index f5ac78329421b49cc263ccd79d51727b510fa018..eb7c913b8381095c44da1dfceef1cc8b39913320 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-21  Jakub Jelinek  <jakub@redhat.com>
+
+       * hashtab.c (htab_traverse): Don't call htab_expand for
+       nearly empty hashtabs with sizes 7, 13 or 31.
+
 2009-06-16  Nick Clifton  <nickc@redhat.com>
 
        PR 10197
index bf34a6d297ed09630aa6754c48df4ede92f4452a..3e649215f4205b860bdd6e52e6c971d71fd433d6 100644 (file)
@@ -1,5 +1,5 @@
 /* An expandable hash tables datatype.  
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2009
    Free Software Foundation, Inc.
    Contributed by Vladimir Makarov (vmakarov@cygnus.com).
 
@@ -759,7 +759,8 @@ htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info)
 void
 htab_traverse (htab_t htab, htab_trav callback, PTR info)
 {
-  if (htab_elements (htab) * 8 < htab_size (htab))
+  size_t size = htab_size (htab);
+  if (htab_elements (htab) * 8 < size && size > 32)
     htab_expand (htab);
 
   htab_traverse_noresize (htab, callback, info);