aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-01-29 06:48:43 -0700
committerMarkus Armbruster <armbru@redhat.com>2016-02-08 17:29:55 +0100
commit9b65859d5e2e43fa89365224c5330e8c72ab760b (patch)
tree170ad5e281f25979a3146515fce1c065c255dfe1 /vl.c
parent7019738d4c9ce49b8fad09e9774393ad127b835d (diff)
hmp: Cache use of qapi visitor
Cache the visitor in a local variable instead of repeatedly calling the accessor. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1454075341-13658-8-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/vl.c b/vl.c
index db51ebd2a6..245b2bad6d 100644
--- a/vl.c
+++ b/vl.c
@@ -2824,17 +2824,19 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp)
OptsVisitor *ov;
QDict *pdict;
bool (*type_predicate)(const char *) = opaque;
+ Visitor *v;
ov = opts_visitor_new(opts);
pdict = qemu_opts_to_qdict(opts, NULL);
+ v = opts_get_visitor(ov);
- visit_start_struct(opts_get_visitor(ov), NULL, NULL, NULL, 0, &err);
+ visit_start_struct(v, NULL, NULL, NULL, 0, &err);
if (err) {
goto out;
}
qdict_del(pdict, "qom-type");
- visit_type_str(opts_get_visitor(ov), &type, "qom-type", &err);
+ visit_type_str(v, &type, "qom-type", &err);
if (err) {
goto out;
}
@@ -2843,16 +2845,16 @@ static int object_create(void *opaque, QemuOpts *opts, Error **errp)
}
qdict_del(pdict, "id");
- visit_type_str(opts_get_visitor(ov), &id, "id", &err);
+ visit_type_str(v, &id, "id", &err);
if (err) {
goto out;
}
- object_add(type, id, pdict, opts_get_visitor(ov), &err);
+ object_add(type, id, pdict, v, &err);
if (err) {
goto out;
}
- visit_end_struct(opts_get_visitor(ov), &err);
+ visit_end_struct(v, &err);
if (err) {
qmp_object_del(id, NULL);
}