public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb: use a range based for loop when iterating over an array
Date: Thu, 24 Feb 2022 16:39:49 +0000 (GMT) [thread overview]
Message-ID: <20220224163949.8F0B03858402@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dd1ae8eaa369ac5c7df7e55c929b42ac8ac44526
commit dd1ae8eaa369ac5c7df7e55c929b42ac8ac44526
Author: Andrew Burgess <aburgess@redhat.com>
Date: Tue Nov 30 14:18:09 2021 +0000
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.
Diff:
---
gdb/python/py-type.c | 8 ++------
1 file 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 }
};
\f
@@ -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;
}
reply other threads:[~2022-02-24 16:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220224163949.8F0B03858402@sourceware.org \
--to=aburgess@sourceware.org \
--cc=gdb-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).