diff options
author | Tom Tromey <tom@tromey.com> | 2023-01-19 20:21:10 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-02-19 12:51:06 -0700 |
commit | a1b294260f4e43cfb7edb2a917accb82945ed310 (patch) | |
tree | e350a15d6bdf7e464df06cb8cbba357dec884458 /gdb/python/py-block.c | |
parent | 1c49bb455c2b401b508b3f3d5924ba461e153ad4 (diff) | |
download | binutils-a1b294260f4e43cfb7edb2a917accb82945ed310.zip binutils-a1b294260f4e43cfb7edb2a917accb82945ed310.tar.gz binutils-a1b294260f4e43cfb7edb2a917accb82945ed310.tar.bz2 |
Remove ALL_BLOCK_SYMBOLS_WITH_NAME
This removes ALL_BLOCK_SYMBOLS_WITH_NAME in favor of foreach.
Diffstat (limited to 'gdb/python/py-block.c')
-rw-r--r-- | gdb/python/py-block.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index bd2ce7f..da33d4c 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -265,24 +265,18 @@ blpy_getitem (PyObject *self, PyObject *key) lookup_name_info lookup_name (name.get(), symbol_name_match_type::FULL); - /* We use ALL_BLOCK_SYMBOLS_WITH_NAME instead of block_lookup_symbol so - that we can look up symbols irrespective of the domain, matching the - iterator. It would be confusing if the iterator returns symbols you - can't find via getitem. */ - struct block_iterator iter; - struct symbol *sym = nullptr; - ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym) + /* We use an iterator instead of block_lookup_symbol so that we can + look up symbols irrespective of the domain, matching the + iterator. It would be confusing if the iterator returns symbols + you can't find via getitem. */ + for (struct symbol *sym : block_iterator_range (block, &lookup_name)) { /* Just stop at the first match */ - break; + return symbol_to_symbol_object (sym); } - if (sym == nullptr) - { - PyErr_SetObject (PyExc_KeyError, key); - return nullptr; - } - return symbol_to_symbol_object (sym); + PyErr_SetObject (PyExc_KeyError, key); + return nullptr; } static void |