qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: berrange@redhat.com, armbru@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 1/5] qobject: ensure base is at offset 0
Date: Tue, 17 Apr 2018 13:17:46 -0500	[thread overview]
Message-ID: <ea5c5be8-2e0f-ed00-8ce1-aee6d6e117d4@redhat.com> (raw)
In-Reply-To: <20180417133602.23832-2-marcandre.lureau@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1252 bytes --]

On 04/17/2018 08:35 AM, Marc-André Lureau wrote:
> All QObject types have the base QObject as first field. This allows to

s/as/as their/

> simplify qobject_to() and will allow further simplification in

s/allows to simplify/allows the simplification of/
s/in/in the/

> following patch.

Might also be worth mentioning that this explicitly guarantees that
existing casts work correctly (even though we'd prefer to get rid of
such casts in any location except the qobject.h macros); Markus pointed out:

>> Uh, there's another reason: existing type casts from QObject * to
>> subtypes.  I just spotted one in tests/check-qdict.c:
>> 
>>     dst = (QDict *)qdict_crumple(src, &error_abort);


> +++ b/qobject/qobject.c
> @@ -16,6 +16,15 @@
>  #include "qapi/qmp/qlist.h"
>  #include "qapi/qmp/qstring.h"
>  
> +QEMU_BUILD_BUG_MSG(
> +    offsetof(QNull, base) != 0 ||

Is the ' != 0' portion necessary?  Style-wise, I'd have avoided it, but
HACKING doesn't forbid it, so I'm fine if you leave it.

With the commit message further improved,
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 --]

  reply	other threads:[~2018-04-17 18:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 13:35 [Qemu-devel] [PATCH v5 0/5] Simplify qobject refcount Marc-André Lureau
2018-04-17 13:35 ` [Qemu-devel] [PATCH v5 1/5] qobject: ensure base is at offset 0 Marc-André Lureau
2018-04-17 18:17   ` Eric Blake [this message]
2018-04-18 16:45     ` Markus Armbruster
2018-04-18 16:58       ` Marc-André Lureau
2018-04-18 17:04       ` Eric Blake
2018-04-19  6:07         ` Markus Armbruster
2018-04-17 13:35 ` [Qemu-devel] [PATCH v5 2/5] qobject: use a QObjectBase_ struct Marc-André Lureau
2018-04-17 18:33   ` Eric Blake
2018-04-19  6:11   ` Markus Armbruster
2018-04-17 13:36 ` [Qemu-devel] [PATCH v5 3/5] qobject: replace qobject_incref/QINCREF qobject_decref/QDECREF Marc-André Lureau
2018-04-17 18:46   ` Eric Blake
2018-04-19  6:16   ` Markus Armbruster
2018-04-19 14:27     ` Marc-André Lureau
2018-04-17 13:36 ` [Qemu-devel] [PATCH v5 4/5] qobject: modify qobject_ref() to return obj Marc-André Lureau
2018-04-17 18:50   ` Eric Blake
2018-04-19  6:25     ` Markus Armbruster
2018-04-17 13:36 ` [Qemu-devel] [PATCH v5 5/5] qobject: modify qobject_ref() to assert on NULL Marc-André Lureau
2018-04-17 18:51   ` Eric Blake
2018-04-19  6:18   ` Markus Armbruster
2018-04-19 13:37     ` Marc-André Lureau
2018-04-19  6:44 ` [Qemu-devel] [PATCH v5 0/5] Simplify qobject refcount Markus Armbruster
2018-04-19 10:09   ` Marc-André Lureau
2018-04-19 11:48     ` Marc-André Lureau
2018-04-19 13:13       ` 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=ea5c5be8-2e0f-ed00-8ce1-aee6d6e117d4@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@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).