From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 1/2] gdb: use ARRAY_SIZE for iterating over an array
Date: Fri, 3 Dec 2021 16:06:38 +0000 [thread overview]
Message-ID: <aa2ba961b007f20d80b059b2474916209ff4af87.1638547512.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1638547512.git.aburgess@redhat.com>
Make use of ARRAY_SIZE to loop over a static global array, removes the
need to have a null entry at the end of the array.
There should be no user visible changes after this commit.
---
gdb/python/py-type.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 8b17b70fbe3..ab9447a3ac6 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
@@ -1453,7 +1452,7 @@ gdbpy_initialize_types (void)
if (PyType_Ready (&type_iterator_object_type) < 0)
return -1;
- for (i = 0; pyty_codes[i].name; ++i)
+ for (i = 0; i < ARRAY_SIZE (pyty_codes); ++i)
{
if (PyModule_AddIntConstant (gdb_module, pyty_codes[i].name,
pyty_codes[i].code) < 0)
--
2.25.4
next prev parent reply other threads:[~2021-12-03 16:06 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 16:06 [PATCH 0/2] Add new gdb.Type.signedness attribute Andrew Burgess
2021-12-03 16:06 ` Andrew Burgess [this message]
2021-12-03 21:02 ` [PATCH 1/2] gdb: use ARRAY_SIZE for iterating over an array Tom Tromey
2021-12-03 16:06 ` [PATCH 2/2] gdb/python: add Type.signedness attribute Andrew Burgess
2021-12-03 21:05 ` Tom Tromey
2021-12-06 14:08 ` [PATCHv2 0/2] Add new gdb.Type.signedness attribute Andrew Burgess
2021-12-06 14:08 ` [PATCHv2 1/2] gdb: use a range based for loop when iterating over an array Andrew Burgess
2022-02-24 16:40 ` Andrew Burgess
2021-12-06 14:08 ` [PATCHv2 2/2] gdb/python: add Type.signedness attribute Andrew Burgess
2021-12-08 3:13 ` Simon Marchi
2021-12-08 9:56 ` Andrew Burgess
2021-12-08 10:19 ` [PATCHv3 " Andrew Burgess
2021-12-08 13:35 ` [PATCHv2 " Simon Marchi
2021-12-08 16:56 ` Tom Tromey
2021-12-09 12:34 ` Andrew Burgess
2021-12-07 19:26 ` [PATCHv2 0/2] Add new gdb.Type.signedness attribute Tom Tromey
2022-02-25 13:55 ` [PATCHv3 0/3] Add Type.is_scalar and Type.is_signed properties Andrew Burgess
2022-02-25 13:55 ` [PATCHv3 1/3] gdb/python: add Type.is_scalar property Andrew Burgess
2022-02-25 14:11 ` Eli Zaretskii
2022-02-25 13:55 ` [PATCHv3 2/3] gdb/python: add Type.is_signed property Andrew Burgess
2022-02-25 14:12 ` Eli Zaretskii
2022-02-25 13:55 ` [PATCHv3 3/3] gdb/testsuite: add new test for comparing char types in Python Andrew Burgess
[not found] ` <cover.1645788436.git.aburgess__7628.6948680476$1645797489$gmane$org@redhat.com>
2022-02-25 17:08 ` [PATCHv3 0/3] Add Type.is_scalar and Type.is_signed properties Tom Tromey
2022-03-07 19:43 ` Andrew Burgess
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=aa2ba961b007f20d80b059b2474916209ff4af87.1638547512.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@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).