aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 728f471801..4dfb27df37 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -491,16 +491,16 @@ fail:
static void dump_json_image_check(ImageCheck *check, bool quiet)
{
QString *str;
- QmpOutputVisitor *ov = qmp_output_visitor_new();
QObject *obj;
- visit_type_ImageCheck(qmp_output_get_visitor(ov), NULL, &check,
- &error_abort);
- obj = qmp_output_get_qobject(ov);
+ Visitor *v = qmp_output_visitor_new(&obj);
+
+ visit_type_ImageCheck(v, NULL, &check, &error_abort);
+ visit_complete(v, &obj);
str = qobject_to_json_pretty(obj);
assert(str != NULL);
qprintf(quiet, "%s\n", qstring_get_str(str));
qobject_decref(obj);
- visit_free(qmp_output_get_visitor(ov));
+ visit_free(v);
QDECREF(str);
}
@@ -2181,32 +2181,32 @@ static void dump_snapshots(BlockDriverState *bs)
static void dump_json_image_info_list(ImageInfoList *list)
{
QString *str;
- QmpOutputVisitor *ov = qmp_output_visitor_new();
QObject *obj;
- visit_type_ImageInfoList(qmp_output_get_visitor(ov), NULL, &list,
- &error_abort);
- obj = qmp_output_get_qobject(ov);
+ Visitor *v = qmp_output_visitor_new(&obj);
+
+ visit_type_ImageInfoList(v, NULL, &list, &error_abort);
+ visit_complete(v, &obj);
str = qobject_to_json_pretty(obj);
assert(str != NULL);
printf("%s\n", qstring_get_str(str));
qobject_decref(obj);
- visit_free(qmp_output_get_visitor(ov));
+ visit_free(v);
QDECREF(str);
}
static void dump_json_image_info(ImageInfo *info)
{
QString *str;
- QmpOutputVisitor *ov = qmp_output_visitor_new();
QObject *obj;
- visit_type_ImageInfo(qmp_output_get_visitor(ov), NULL, &info,
- &error_abort);
- obj = qmp_output_get_qobject(ov);
+ Visitor *v = qmp_output_visitor_new(&obj);
+
+ visit_type_ImageInfo(v, NULL, &info, &error_abort);
+ visit_complete(v, &obj);
str = qobject_to_json_pretty(obj);
assert(str != NULL);
printf("%s\n", qstring_get_str(str));
qobject_decref(obj);
- visit_free(qmp_output_get_visitor(ov));
+ visit_free(v);
QDECREF(str);
}