[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-for-5.0] gdbstub: Do not use memset() on GByteArray

From: Peter Maydell
Subject: Re: [PATCH-for-5.0] gdbstub: Do not use memset() on GByteArray
Date: Tue, 14 Apr 2020 12:49:38 +0100

On Tue, 14 Apr 2020 at 12:05, Philippe Mathieu-Daudé <address@hidden> 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.
(Contrast GBytes, where there are no defined public
fields and instead there are functions g_bytes_get_data
and g_bytes_get_size.)

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]