[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 07/28] string-input-visitor: Favor new visit_
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v4 07/28] string-input-visitor: Favor new visit_free() function |
Date: |
Wed, 01 Jun 2016 18:13:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> Now that we have a polymorphic visit_free(), we no longer need
> string_input_visitor_cleanup(); which in turn means we no longer
> need to return a subtype from string_input_visitor_new() nor a
> public upcast function.
>
> Signed-off-by: Eric Blake <address@hidden>
[...]
> diff --git a/qom/object.c b/qom/object.c
> index 1562f7e..00dd68c 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -1216,7 +1216,7 @@ int object_property_get_enum(Object *obj, const char
> *name,
> {
> Error *err = NULL;
> StringOutputVisitor *sov;
> - StringInputVisitor *siv;
> + Visitor *v;
> char *str;
> int ret;
> ObjectProperty *prop = object_property_find(obj, name, errp);
> @@ -1243,13 +1243,12 @@ int object_property_get_enum(Object *obj, const char
> *name,
> return 0;
> }
> str = string_output_get_string(sov);
> - siv = string_input_visitor_new(str);
> string_output_visitor_cleanup(sov);
> - visit_type_enum(string_input_get_visitor(siv), name, &ret,
> - enumprop->strings, errp);
> + v = string_input_visitor_new(str);
> + visit_type_enum(v, name, &ret, enumprop->strings, errp);
>
> g_free(str);
> - string_input_visitor_cleanup(siv);
> + visit_free(v);
>
> return ret;
> }
> @@ -1259,7 +1258,7 @@ void object_property_get_uint16List(Object *obj, const
> char *name,
> {
> Error *err = NULL;
> StringOutputVisitor *ov;
> - StringInputVisitor *iv;
> + Visitor *v;
> char *str;
>
> ov = string_output_visitor_new(false);
> @@ -1270,11 +1269,11 @@ void object_property_get_uint16List(Object *obj,
> const char *name,
> goto out;
> }
> str = string_output_get_string(ov);
> - iv = string_input_visitor_new(str);
> - visit_type_uint16List(string_input_get_visitor(iv), NULL, list, errp);
> + v = string_input_visitor_new(str);
> + visit_type_uint16List(v, NULL, list, errp);
>
> g_free(str);
> - string_input_visitor_cleanup(iv);
> + visit_free(v);
> out:
> string_output_visitor_cleanup(ov);
> }
> @@ -1282,11 +1281,9 @@ out:
> void object_property_parse(Object *obj, const char *string,
> const char *name, Error **errp)
> {
> - StringInputVisitor *siv;
> - siv = string_input_visitor_new(string);
> - object_property_set(obj, string_input_get_visitor(siv), name, errp);
> -
> - string_input_visitor_cleanup(siv);
> + Visitor *v = string_input_visitor_new(string);
Blank line between declaration and statements, please.
> + object_property_set(obj, v, name, errp);
> + visit_free(v);
> }
>
> char *object_property_print(Object *obj, const char *name, bool human,
[...]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v4 07/28] string-input-visitor: Favor new visit_free() function,
Markus Armbruster <=