Quoting Markus Armbruster (2014-04-28 15:27:48)
> visit_type_TestStruct() does nothing when called with an error set.
> Callers shouldn't do that, and no caller does.  Drop the superfluous
> test.
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> Reviewed-by: Eric Blake <ebl...@redhat.com>

Reviewed-by: Michael Roth <mdr...@linux.vnet.ibm.com>

> ---
>  tests/test-qmp-input-visitor.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c
> index 1ebafc5..a58a3e6 100644
> --- a/tests/test-qmp-input-visitor.c
> +++ b/tests/test-qmp-input-visitor.c
> @@ -196,21 +196,20 @@ static void visit_type_TestStruct(Visitor *v, 
> TestStruct **obj,
>                                    const char *name, Error **errp)
>  {
>      Error *err = NULL;
> -    if (!error_is_set(errp)) {
> -        visit_start_struct(v, (void **)obj, "TestStruct", name, 
> sizeof(TestStruct),
> -                           &err);
> -        if (!err) {
> -            visit_type_int(v, &(*obj)->integer, "integer", &err);
> -            visit_type_bool(v, &(*obj)->boolean, "boolean", &err);
> -            visit_type_str(v, &(*obj)->string, "string", &err);
> -
> -            /* Always call end_struct if start_struct succeeded.  */
> -            error_propagate(errp, err);
> -            err = NULL;
> -            visit_end_struct(v, &err);
> -        }
> +
> +    visit_start_struct(v, (void **)obj, "TestStruct", name, 
> sizeof(TestStruct),
> +                       &err);
> +    if (!err) {
> +        visit_type_int(v, &(*obj)->integer, "integer", &err);
> +        visit_type_bool(v, &(*obj)->boolean, "boolean", &err);
> +        visit_type_str(v, &(*obj)->string, "string", &err);
> +
> +        /* Always call end_struct if start_struct succeeded.  */
>          error_propagate(errp, err);
> +        err = NULL;
> +        visit_end_struct(v, &err);
>      }
> +    error_propagate(errp, err);
>  }
> 
>  static void test_visitor_in_struct(TestInputVisitorData *data,
> -- 
> 1.8.1.4


Reply via email to