From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com,
berrange@redhat.com, eduardo@habkost.net, philmd@linaro.org
Subject: Re: [PATCH 1/3] qdev: Change PropertyInfo method print() to return malloc'ed string
Date: Wed, 22 Oct 2025 16:08:45 +0200 [thread overview]
Message-ID: <87v7k7c9le.fsf@pond.sub.org> (raw)
In-Reply-To: <CAJ+F1CKdasvQ14r+e2OEKFk+=4Yu2Mgg8EqSe_ZNQJDVoyiEKA@mail.gmail.com> ("Marc-André Lureau"'s message of "Wed, 22 Oct 2025 14:59:57 +0400")
Marc-André Lureau <marcandre.lureau@gmail.com> writes:
> Hi
>
> On Wed, Oct 22, 2025 at 2:15 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Simpler (more so after the next commit), and no risk of truncation
>> because the caller's buffer is too small. Performance doesn't matter;
>> the method is only used for "info qdev".
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
[...]
>> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
>> index b7e8a89ba5..422a486969 100644
>> --- a/hw/core/qdev-properties.c
>> +++ b/hw/core/qdev-properties.c
>> @@ -1117,12 +1117,11 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v,
>> Error **errp)
>> {
>> const Property *prop = opaque;
>> + char *s;
>
> Why not g_autofree ?
Old habits... I think it's a wash here, because there's just one path
through the function.
>> - char buffer[1024];
>> - char *ptr = buffer;
>> -
>> - prop->info->print(obj, prop, buffer, sizeof(buffer));
>> - visit_type_str(v, name, &ptr, errp);
>> + s = prop->info->print(obj, prop);
>> + visit_type_str(v, name, &s, errp);
>> + g_free(s);
>
> otherwise,
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Thanks!
next prev parent reply other threads:[~2025-10-22 14:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 10:14 [PATCH 0/3] qdev: Fix "info qtree" to show links Markus Armbruster
2025-10-22 10:14 ` [PATCH 1/3] qdev: Change PropertyInfo method print() to return malloc'ed string Markus Armbruster
2025-10-22 10:59 ` Marc-André Lureau
2025-10-22 14:08 ` Markus Armbruster [this message]
2025-10-22 10:14 ` [PATCH 2/3] qdev: Fix "info qtree" to show links Markus Armbruster
2025-10-22 11:00 ` Marc-André Lureau
2025-10-24 7:05 ` Paolo Bonzini
2025-10-28 10:33 ` Markus Armbruster
2025-10-28 10:59 ` Daniel P. Berrangé
2025-10-28 13:10 ` Paolo Bonzini
2025-10-28 11:04 ` Peter Maydell
2025-10-28 12:58 ` Paolo Bonzini
2025-11-07 13:02 ` Markus Armbruster
2025-11-22 9:10 ` Markus Armbruster
2025-10-22 10:14 ` [PATCH 3/3] qdev: Legacy properties are now unused, drop Markus Armbruster
2025-10-22 11:13 ` Marc-André Lureau
2025-10-22 12:12 ` Markus Armbruster
2025-12-03 9:56 ` Markus Armbruster
2025-12-03 9:58 ` [PATCH 0/3] qdev: Fix "info qtree" to show links Markus Armbruster
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=87v7k7c9le.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eduardo@habkost.net \
--cc=marcandre.lureau@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.