public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCHv2 1/2] gdb: use a range based for loop when iterating over an array
Date: Thu, 24 Feb 2022 16:40:35 +0000	[thread overview]
Message-ID: <878ru0b4l8.fsf@redhat.com> (raw)
In-Reply-To: <4f17406a0847307824e496edc06250101c1a0d6f.1638799543.git.aburgess@redhat.com>

aburgess@redhat.com (Andrew Burgess) writes:

> 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.

I've gone ahead and pushed just this patch from this series.

Thanks,
Andrew



> ---
>  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 8b17b70fbe3..15d73fe94e4 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
> @@ -1444,8 +1443,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)
> @@ -1453,10 +1450,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;
>      }
>  
> -- 
> 2.25.4


  reply	other threads:[~2022-02-24 16:40 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 ` [PATCH 1/2] gdb: use ARRAY_SIZE for iterating over an array Andrew Burgess
2021-12-03 21:02   ` 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 [this message]
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=878ru0b4l8.fsf@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).