From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qobject: Use qobject_to() instead of type cast
Date: Thu, 26 Apr 2018 10:49:01 -0500 [thread overview]
Message-ID: <2695025c-30de-720a-4437-348a3bb7911b@redhat.com> (raw)
In-Reply-To: <20180426152805.8469-1-armbru@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 929 bytes --]
On 04/26/2018 10:28 AM, Markus Armbruster wrote:
> The proper way to convert from (abstract) QObject to a (concrete)
> subtype is qobject_to(). Look for offenders that type cast instead:
>
> $ git-grep '(Q[A-Z][a-z]* \*)'
> hmp.c: qmp_device_add((QDict *)qdict, NULL, &err);
> include/qapi/qmp/qobject.h: return (QObject *)obj;
> qobject/qobject.c:static void (*qdestroy[QTYPE__MAX])(QObject *) = {
> tests/check-qdict.c: dst = (QDict *)qdict_crumple(src, &error_abort);
>
> The first two cast away const, the third isn't a type cast. Fix the
> fourth.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> tests/check-qdict.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2018-04-26 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 15:28 [Qemu-devel] [PATCH] qobject: Use qobject_to() instead of type cast Markus Armbruster
2018-04-26 15:49 ` Eric Blake [this message]
2018-04-26 18:59 ` Marc-André Lureau
2018-05-02 8:30 ` 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=2695025c-30de-720a-4437-348a3bb7911b@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=marcandre.lureau@redhat.com \
--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).