All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, lcapitulino@redhat.com, famz@redhat.com,
	qemu-stable@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_start_union
Date: Thu, 11 Sep 2014 20:34:53 -0600	[thread overview]
Message-ID: <54125BCD.7050602@redhat.com> (raw)
In-Reply-To: <1410477659-9163-3-git-send-email-mdroth@linux.vnet.ibm.com>

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

On 09/11/2014 05:20 PM, Michael Roth wrote:
> If the .data field of a QAPI Union is NULL, we don't need to free
> any of the union fields..

intentional double dot?

> 
> Make use of the new visit_start_union interface to access this
> information and instruct the generated code to not visit these
> fields when this occurs.
> 
> Cc: qemu-stable@nongnu.org
> Reported-by: Fam Zheng <famz@redhat.com>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  qapi/qapi-dealloc-visitor.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c
> index dc53545..eb77078 100644
> --- a/qapi/qapi-dealloc-visitor.c
> +++ b/qapi/qapi-dealloc-visitor.c
> @@ -162,6 +162,11 @@ static void qapi_dealloc_type_enum(Visitor *v, int *obj, const char *strings[],
>  {
>  }
>  
> +static bool qapi_dealloc_start_union(Visitor *v, bool data_present, Error **errp)

Long line.

> +{
> +    return data_present;

Okay, so this is a case where you can return false without setting errp.
 It would be nice to document the interactions and contract of this
visitor here or in patch 1.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

  reply	other threads:[~2014-09-12  2:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 23:20 [Qemu-devel] [PATCH 0/3] qapi: fix crash in dealloc visitor for union types Michael Roth
2014-09-11 23:20 ` [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union Michael Roth
2014-09-12  2:29   ` Eric Blake
2014-09-12 15:22     ` Michael Roth
2014-09-12 10:17   ` Paolo Bonzini
2014-09-12 15:34     ` Michael Roth
2014-09-12 15:39       ` Paolo Bonzini
2014-09-12 16:17         ` Michael Roth
2014-09-12 16:29           ` Paolo Bonzini
2014-09-12 18:28             ` Michael Roth
2014-09-11 23:20 ` [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_start_union Michael Roth
2014-09-12  2:34   ` Eric Blake [this message]
2014-09-11 23:20 ` [Qemu-devel] [PATCH 3/3] tests: add QMP input visitor test for unions with no discriminator Michael Roth
2014-09-12  3:04 ` [Qemu-devel] [PATCH 4/3] qemu-iotests: Test missing "driver" key for blockdev-add Fam Zheng
2014-09-12  4:17   ` Eric Blake
2014-09-12  3:06 ` [Qemu-devel] [PATCH 0/3] qapi: fix crash in dealloc visitor for union types Fam Zheng

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=54125BCD.7050602@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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.