qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Max Filippov" <jcmvbkbc@gmail.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [PATCH-for-5.0] gdbstub: Do not use memset() on GByteArray
Date: Tue, 14 Apr 2020 15:22:19 +0100	[thread overview]
Message-ID: <87d08a9mg4.fsf@linaro.org> (raw)
In-Reply-To: <CAFEAcA8BgkqNQToJZy0=SOSxF2QWgxrP79Gj1qaVUm5xdvm65A@mail.gmail.com>


Peter Maydell <peter.maydell@linaro.org> writes:

> On Tue, 14 Apr 2020 at 12:05, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>> > The other implementation option here would be
>> >
>> >       guint oldlen = array->len;
>> >       g_byte_array_set_size(array, oldlen + len);
>> >       memset(array->data + oldlen, 0, len);
>>
>> I thought about it but I'd rather not access GByteArray internals.
>
> AIUI ->len and ->data are not internals -- they're
> in the documentation as "public fields" and the code
> example for GByteArray directly accesses ->data.

They are - and I do it in a few places in the gdbstub when it's easier
than going long form. FWIW I prefer Peter's formulation.

> (Contrast GBytes, where there are no defined public
> fields and instead there are functions g_bytes_get_data
> and g_bytes_get_size.)
>
> thanks
> -- PMM


-- 
Alex Bennée


  reply	other threads:[~2020-04-14 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14 10:24 [PATCH-for-5.0] gdbstub: Do not use memset() on GByteArray Philippe Mathieu-Daudé
2020-04-14 10:52 ` Peter Maydell
2020-04-14 11:05   ` Philippe Mathieu-Daudé
2020-04-14 11:49     ` Peter Maydell
2020-04-14 14:22       ` Alex Bennée [this message]
2020-04-14 16:09 ` Alex Bennée

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=87d08a9mg4.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).