diff options
author | DJ Delorie <dj@redhat.com> | 2003-03-17 18:01:07 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2003-03-17 18:01:07 +0000 |
commit | f77ed96c7bc56ceff1efa81a78fc9a02006e844f (patch) | |
tree | cd8acc2682704bffc79e5de7bff61a59b6549cd7 /libiberty/hashtab.c | |
parent | 1132738f98cdf50047f482b17e9777505fb8495c (diff) | |
download | gdb-f77ed96c7bc56ceff1efa81a78fc9a02006e844f.zip gdb-f77ed96c7bc56ceff1efa81a78fc9a02006e844f.tar.gz gdb-f77ed96c7bc56ceff1efa81a78fc9a02006e844f.tar.bz2 |
merge from gcc
Diffstat (limited to 'libiberty/hashtab.c')
-rw-r--r-- | libiberty/hashtab.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index ebaa43b..2f8dfd6c 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 |