[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/13] qapi: Replace start_optional()/end_option
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 04/13] qapi: Replace start_optional()/end_optional() by optional() |
Date: |
Mon, 05 May 2014 11:09:05 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 05/02/2014 06:44 AM, Markus Armbruster wrote:
> Semantics of end_optional() differ subtly from the other end_FOO()
> callbacks: when start_FOO() succeeds, the matching end_FOO() gets
> called regardless of what happens in between. end_optional() gets
> called only when everything in between succeeds as well. Entirely
> undocumented, like all of the visitor API.
>
> The only user of Visitor Callback end_optional() never did anything,
> and was removed in commit 9f9ab46.
>
> I'm about to clean up error handling in the generated visitor code,
> and end_optional() is in my way. No users mean no test cases, and
> making non-trivial cleanup transformations without test cases doesn't
> strike me as a good idea.
>
> Drop end_optional(), and rename start_optional() to optional(). We
> can always go back to a pair of callbacks when we have an actual need.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> include/qapi/visitor-impl.h | 5 ++---
> include/qapi/visitor.h | 5 ++---
> qapi/opts-visitor.c | 5 ++---
> qapi/qapi-visit-core.c | 15 ++++-----------
> qapi/qmp-input-visitor.c | 6 +++---
> qapi/string-input-visitor.c | 6 +++---
> scripts/qapi-commands.py | 5 ++---
> scripts/qapi-visit.py | 3 +--
> 8 files changed, 19 insertions(+), 31 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
> +++ b/qapi/opts-visitor.c
> @@ -483,8 +483,7 @@ opts_type_size(Visitor *v, uint64_t *obj, const char
> *name, Error **errp)
>
>
> static void
> -opts_start_optional(Visitor *v, bool *present, const char *name,
> - Error **errp)
> +opts_optional(Visitor *v, bool *present, const char *name, Error **errp)
Managed to fix an indentation problem while at it :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH 04/13] qapi: Replace start_optional()/end_optional() by optional(), Markus Armbruster, 2014/05/02
- Re: [Qemu-devel] [PATCH 04/13] qapi: Replace start_optional()/end_optional() by optional(),
Eric Blake <=
[Qemu-devel] [PATCH 08/13] qapi: Un-inline visit of implicit struct, Markus Armbruster, 2014/05/02
[Qemu-devel] [PATCH 03/13] qapi: Remove unused Visitor callbacks start_handle(), end_handle(), Markus Armbruster, 2014/05/02
[Qemu-devel] [PATCH 09/13] hmp: Call visit_end_struct() after visit_start_struct() succeeds, Markus Armbruster, 2014/05/02
[Qemu-devel] [PATCH 02/13] qapi: Normalize marshalling's visitor initialization and cleanup, Markus Armbruster, 2014/05/02
[Qemu-devel] [PATCH 05/13] qapi-visit.py: Clean up confusing push_indent() / pop_indent() use, Markus Armbruster, 2014/05/02