summaryrefslogtreecommitdiff
path: root/gdb/block.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-07-20 18:04:46 +0100
committerPedro Alves <palves@redhat.com>2017-07-20 18:04:46 +0100
commit42edd901a220d9d963d2121d7014b81d43c1ac66 (patch)
treea82da7afe0d71a60890287dfe5d1200b94b488b3 /gdb/block.c
parentcf3252992378872212eeaaca090fe3b1491bcd3f (diff)
downloadbinutils-gdb-42edd901a220d9d963d2121d7014b81d43c1ac66.tar.gz
Eliminate block_iter_name_*
This patch gets rid of block_iter_name_* as being unnecessary. It's the same as calling block_iter_match_*, and passing strcmp_iw as comparison routine. (A later patch will get rid of those new explicit strcmp_iw calls.) gdb/ChangeLog: 2017-07-20 Pedro Alves <palves@redhat.com> * block.c (block_iter_name_step, block_iter_name_first) (block_iter_name_next): Delete. (block_lookup_symbol_primary): Adjust to use dict_iter_match_first/dict_iter_match_next. * block.h (block_iter_name_first, block_iter_name_next): Delete declarations. (ALL_BLOCK_SYMBOLS_WITH_NAME): Adjust to use dict_iter_match_first/dict_iter_match_next.
Diffstat (limited to 'gdb/block.c')
-rw-r--r--gdb/block.c73
1 files changed, 2 insertions, 71 deletions
diff --git a/gdb/block.c b/gdb/block.c
index 2f444605ff2..1c343aade73 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -589,75 +589,6 @@ block_iterator_next (struct block_iterator *iterator)
return block_iterator_step (iterator, 0);
}
-/* Perform a single step for a "name" block iterator, iterating across
- symbol tables as needed. Returns the next symbol, or NULL when
- iteration is complete. */
-
-static struct symbol *
-block_iter_name_step (struct block_iterator *iterator, const char *name,
- int first)
-{
- struct symbol *sym;
-
- gdb_assert (iterator->which != FIRST_LOCAL_BLOCK);
-
- while (1)
- {
- if (first)
- {
- struct compunit_symtab *cust
- = find_iterator_compunit_symtab (iterator);
- const struct block *block;
-
- /* Iteration is complete. */
- if (cust == NULL)
- return NULL;
-
- block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
- iterator->which);
- sym = dict_iter_name_first (BLOCK_DICT (block), name,
- &iterator->dict_iter);
- }
- else
- sym = dict_iter_name_next (name, &iterator->dict_iter);
-
- if (sym != NULL)
- return sym;
-
- /* We have finished iterating the appropriate block of one
- symtab. Now advance to the next symtab and begin iteration
- there. */
- ++iterator->idx;
- first = 1;
- }
-}
-
-/* See block.h. */
-
-struct symbol *
-block_iter_name_first (const struct block *block,
- const char *name,
- struct block_iterator *iterator)
-{
- initialize_block_iterator (block, iterator);
-
- if (iterator->which == FIRST_LOCAL_BLOCK)
- return dict_iter_name_first (block->dict, name, &iterator->dict_iter);
-
- return block_iter_name_step (iterator, name, 1);
-}
-
-/* See block.h. */
-
-struct symbol *
-block_iter_name_next (const char *name, struct block_iterator *iterator)
-{
- if (iterator->which == FIRST_LOCAL_BLOCK)
- return dict_iter_name_next (name, &iterator->dict_iter);
-
- return block_iter_name_step (iterator, name, 0);
-}
-
/* Perform a single step for a "match" block iterator, iterating
across symbol tables as needed. Returns the next symbol, or NULL
when iteration is complete. */
@@ -812,9 +743,9 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
|| BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
other = NULL;
- for (sym = dict_iter_name_first (block->dict, name, &dict_iter);
+ for (sym = dict_iter_match_first (block->dict, name, strcmp_iw, &dict_iter);
sym != NULL;
- sym = dict_iter_name_next (name, &dict_iter))
+ sym = dict_iter_match_next (name, strcmp_iw, &dict_iter))
{
if (SYMBOL_DOMAIN (sym) == domain)
return sym;