Now that we have a polymorphic visit_free(), we no longer need
string_output_visitor_cleanup(); however, we still need to
expose the subtype for string_output_get_string().
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <
1465490926-28625-9-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
monitor_printf(mon, " host nodes: %s\n", str);
g_free(str);
- string_output_visitor_cleanup(ov);
+ visit_free(string_output_get_visitor(ov));
m = m->next;
i++;
}
* requires a non-null list argument to visit_start_list().
*/
StringOutputVisitor *string_output_visitor_new(bool human);
-void string_output_visitor_cleanup(StringOutputVisitor *v);
char *string_output_get_string(StringOutputVisitor *v);
Visitor *string_output_get_visitor(StringOutputVisitor *v);
object_property_get(OBJECT(nf), string_output_get_visitor(ov),
prop->name, NULL);
str = string_output_get_string(ov);
- string_output_visitor_cleanup(ov);
+ visit_free(string_output_get_visitor(ov));
monitor_printf(mon, ",%s=%s", prop->name, str);
g_free(str);
}
{
StringOutputVisitor *sov = to_sov(v);
- string_output_visitor_cleanup(sov);
-}
-
-void string_output_visitor_cleanup(StringOutputVisitor *sov)
-{
if (sov->string) {
g_string_free(sov->string, true);
}
enumprop = prop->opaque;
sov = string_output_visitor_new(false);
- object_property_get(obj, string_output_get_visitor(sov), name, &err);
+ v = string_output_get_visitor(sov);
+ object_property_get(obj, v, name, &err);
if (err) {
error_propagate(errp, err);
- string_output_visitor_cleanup(sov);
+ visit_free(v);
return 0;
}
str = string_output_get_string(sov);
- string_output_visitor_cleanup(sov);
+ visit_free(v);
v = string_input_visitor_new(str);
visit_type_enum(v, name, &ret, enumprop->strings, errp);
g_free(str);
visit_free(v);
out:
- string_output_visitor_cleanup(ov);
+ visit_free(string_output_get_visitor(ov));
}
void object_property_parse(Object *obj, const char *string,
string = string_output_get_string(sov);
out:
- string_output_visitor_cleanup(sov);
+ visit_free(string_output_get_visitor(sov));
return string;
}
static void visitor_output_teardown(TestOutputVisitorData *data,
const void *unused)
{
- string_output_visitor_cleanup(data->sov);
+ visit_free(data->ov);
data->sov = NULL;
data->ov = NULL;
}
static void qmp_cleanup(void *datap)
{
QmpSerializeData *d = datap;
- qmp_output_visitor_cleanup(d->qov);
+ visit_free(qmp_output_get_visitor(d->qov));
visit_free(d->qiv);
g_free(d);
{
StringSerializeData *d = datap;
- string_output_visitor_cleanup(d->sov);
+ visit_free(string_output_get_visitor(d->sov));
visit_free(d->siv);
g_free(d->string);
g_free(d);