[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_star
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_start_union |
Date: |
Thu, 11 Sep 2014 20:34:53 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
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: address@hidden
> Reported-by: Fam Zheng <address@hidden>
> Suggested-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Michael Roth <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/3] qapi: fix crash in dealloc visitor for union types, Michael Roth, 2014/09/11
- [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_start_union, Michael Roth, 2014/09/11
- Re: [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_start_union,
Eric Blake <=
- [Qemu-devel] [PATCH 3/3] tests: add QMP input visitor test for unions with no discriminator, Michael Roth, 2014/09/11
- [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Michael Roth, 2014/09/11
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Eric Blake, 2014/09/11
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Paolo Bonzini, 2014/09/12
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Michael Roth, 2014/09/12
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Paolo Bonzini, 2014/09/12
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Michael Roth, 2014/09/12
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Paolo Bonzini, 2014/09/12
- Re: [Qemu-devel] [PATCH 1/3] qapi: add visit_start_union and visit_end_union, Michael Roth, 2014/09/12