qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v9 17/37] qapi: Drop unused 'kind' for struct/en


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v9 17/37] qapi: Drop unused 'kind' for struct/enum visit
Date: Wed, 20 Jan 2016 19:59:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> visit_start_struct() and visit_type_enum() had a 'kind' argument
> that was usually set to either the stringized version of the
> corresponding qapi type name, or to NULL (although some clients
> didn't even get that right).  But nothing ever used the argument.
> It's even hard to argue that it would be useful in a debugger,
> as a stack backtrace also tells which type is being visited.
>
> Therefore, drop the 'kind' argument as dead.
>
> Signed-off-by: Eric Blake <address@hidden>
> Reviewed-by: Marc-André Lureau <address@hidden>
>
> ---
> v9: no change
> v8: rebase to 'name' motion
> v7: new patch
> ---
>  hmp.c                       |  2 +-
>  hw/core/qdev-properties.c   |  6 ++----
>  hw/ppc/spapr_drc.c          |  4 ++--
>  hw/virtio/virtio-balloon.c  |  4 ++--
>  include/qapi/visitor-impl.h | 11 ++++-------
>  include/qapi/visitor.h      |  5 ++---
>  qapi/opts-visitor.c         |  2 +-
>  qapi/qapi-dealloc-visitor.c |  6 ++----
>  qapi/qapi-visit-core.c      | 16 +++++++---------
>  qapi/qmp-input-visitor.c    |  2 +-
>  qapi/qmp-output-visitor.c   |  3 +--
>  qom/object.c                |  8 ++++----
>  scripts/qapi-event.py       |  2 +-
>  scripts/qapi-visit.py       | 12 ++++++------
>  vl.c                        |  2 +-
>  15 files changed, 37 insertions(+), 48 deletions(-)
[...]
> diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
> index 0257359..6abfda7 100644
> --- a/include/qapi/visitor-impl.h
> +++ b/include/qapi/visitor-impl.h
> @@ -19,7 +19,7 @@ struct Visitor
>  {
>      /* Must be set */
>      void (*start_struct)(Visitor *v, const char *name, void **obj,
> -                         const char *kind, size_t size, Error **errp);
> +                         size_t size, Error **errp);
>      void (*end_struct)(Visitor *v, Error **errp);
>
>      void (*start_implicit_struct)(Visitor *v, void **obj, size_t size,
> @@ -31,8 +31,7 @@ struct Visitor
>      void (*end_list)(Visitor *v, Error **errp);
>
>      void (*type_enum)(Visitor *v, const char *name, int *obj,
> -                      const char * const strings[], const char *kind,
> -                      Error **errp);
> +                      const char *const strings[], Error **errp);
>      /* May be NULL; only needed for input visitors. */
>      void (*get_next_type)(Visitor *v, const char *name, QType *type,
>                            bool promote_int, Error **errp);
> @@ -62,10 +61,8 @@ struct Visitor
>  };
>
>  void input_type_enum(Visitor *v, const char *name, int *obj,
> -                     const char * const strings[], const char *kind,
> -                     Error **errp);
> +                     const char *const strings[], Error **errp);
>  void output_type_enum(Visitor *v, const char *name, int *obj,
> -                      const char * const strings[], const char *kind,
> -                      Error **errp);
> +                      const char *const strings[], Error **errp);
>
>  #endif
> diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
> index eb50116..4abc180 100644
> --- a/include/qapi/visitor.h
> +++ b/include/qapi/visitor.h
> @@ -28,7 +28,7 @@ typedef struct GenericList
>  } GenericList;
>
>  void visit_start_struct(Visitor *v, const char *name, void **obj,
> -                        const char *kind, size_t size, Error **errp);
> +                        size_t size, Error **errp);
>  void visit_end_struct(Visitor *v, Error **errp);
>  void visit_start_implicit_struct(Visitor *v, void **obj, size_t size,
>                                   Error **errp);
> @@ -54,8 +54,7 @@ bool visit_optional(Visitor *v, const char *name, bool 
> *present);
>  void visit_get_next_type(Visitor *v, const char *name, QType *type,
>                           bool promote_int, Error **errp);
>  void visit_type_enum(Visitor *v, const char *name, int *obj,
> -                     const char *const strings[], const char *kind,
> -                     Error **errp);
> +                     const char *const strings[], Error **errp);
>  void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error 
> **errp);
>  void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
>                        Error **errp);

Looks good.  We should be able to rely on the compiler to check the
changes to callers.

[...]
> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> index 7bc3de6..b0452cf 100644
> --- a/qapi/qapi-visit-core.c
> +++ b/qapi/qapi-visit-core.c
> @@ -2,6 +2,7 @@
>   * Core Definitions for QAPI Visitor Classes
>   *
>   * Copyright IBM, Corp. 2011
> + * Copyright (C) 2015 Red Hat, Inc.

2012-2015 would be more accurate.

>   *
>   * Authors:
>   *  Anthony Liguori   <address@hidden>
[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]