summaryrefslogtreecommitdiff
path: root/gdb/python/py-type.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2021-11-30 14:18:09 +0000
committerAndrew Burgess <aburgess@redhat.com>2022-02-24 16:10:29 +0000
commitdd1ae8eaa369ac5c7df7e55c929b42ac8ac44526 (patch)
tree4c606731e7d459b85aa1c1317dada957e408bc53 /gdb/python/py-type.c
parent7ff917016a203cdff3074abfcf96c1553944af94 (diff)
downloadbinutils-gdb-dd1ae8eaa369ac5c7df7e55c929b42ac8ac44526.tar.gz
gdb: use a range based for loop when iterating over an array
Make use of a range based for loop to iterate over a static global array, removing the need to have a null entry at the end of the array. There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/python/py-type.c')
-rw-r--r--gdb/python/py-type.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 8613534d060..13dae1e2559 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -113,7 +113,6 @@ static struct pyty_code pyty_codes[] =
ENTRY (TYPE_CODE_NAMESPACE),
ENTRY (TYPE_CODE_DECFLOAT),
ENTRY (TYPE_CODE_INTERNAL_FUNCTION),
- { TYPE_CODE_UNDEF, NULL }
};
@@ -1445,8 +1444,6 @@ _initialize_py_type ()
int
gdbpy_initialize_types (void)
{
- int i;
-
if (PyType_Ready (&type_object_type) < 0)
return -1;
if (PyType_Ready (&field_object_type) < 0)
@@ -1454,10 +1451,9 @@ gdbpy_initialize_types (void)
if (PyType_Ready (&type_iterator_object_type) < 0)
return -1;
- for (i = 0; pyty_codes[i].name; ++i)
+ for (const auto &item : pyty_codes)
{
- if (PyModule_AddIntConstant (gdb_module, pyty_codes[i].name,
- pyty_codes[i].code) < 0)
+ if (PyModule_AddIntConstant (gdb_module, item.name, item.code) < 0)
return -1;
}