aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-03-17 18:59:58 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2003-03-17 17:59:58 +0000
commitdbccdc4211816e31904c7af506aa9f4df60486e4 (patch)
treebb02d898b2f0daa316b346810048df64ac47b8b8 /libiberty
parentec20aa6ccff4a951fcc2fbb78bb8ca7d0ad16be0 (diff)
downloadgcc-dbccdc4211816e31904c7af506aa9f4df60486e4.zip
gcc-dbccdc4211816e31904c7af506aa9f4df60486e4.tar.gz
gcc-dbccdc4211816e31904c7af506aa9f4df60486e4.tar.bz2
ggc-common.c (ggc_mark_roots): Use htab_traverse_noresize.
* ggc-common.c (ggc_mark_roots): Use htab_traverse_noresize. * hashtab.h (htab_traverse_noresize): Declare. * hashtab.c (htab_traverse_noresize): Break out from ... * hashtab.c (htab_traverse): ... here. From-SVN: r64496
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/hashtab.c23
2 files changed, 24 insertions, 4 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 052d99f..d4b84d3 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2003-17-03 Jan Hubicka <jh@suse.cz>
+
+ * hashtab.c (htab_traverse_noresize): Break out from ...
+ * hashtab.c (htab_traverse): ... here.
+
2003-12-03 Jan Hubicka <jh@suse.cz>
* hashtab.c (htab_expand): Fix warning.
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index ebaa43b..2f8dfd6 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -603,7 +603,7 @@ htab_clear_slot (htab, slot)
argument. */
void
-htab_traverse (htab, callback, info)
+htab_traverse_noresize (htab, callback, info)
htab_t htab;
htab_trav callback;
PTR info;
@@ -611,9 +611,6 @@ htab_traverse (htab, callback, info)
PTR *slot;
PTR *limit;
- if ((htab->n_elements - htab->n_deleted) * 8 < htab->size)
- htab_expand (htab);
-
slot = htab->entries;
limit = slot + htab->size;
@@ -628,6 +625,24 @@ htab_traverse (htab, callback, info)
while (++slot < limit);
}
+/* Like htab_traverse_noresize, but does resize the table when it is
+ too empty to improve effectivity of subsequent calls. */
+
+void
+htab_traverse (htab, callback, info)
+ htab_t htab;
+ htab_trav callback;
+ PTR info;
+{
+ PTR *slot;
+ PTR *limit;
+
+ if ((htab->n_elements - htab->n_deleted) * 8 < htab->size)
+ htab_expand (htab);
+
+ htab_traverse_noresize (htab, callback, info);
+}
+
/* Return the current size of given hash table. */
size_t