mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
monitor: reuse user_creatable_add_opts() instead of user_creatable_add()
Simplify code by dropping ~57LOC by merging user_creatable_add() into user_creatable_add_opts() and using the later from monitor. Along with it allocate opts_visitor_new() once in user_creatable_add_opts(). As result we have one less API func and a more readable/simple user_creatable_add_opts() vs user_creatable_add(). Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1484052795-158195-3-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
8a000250f1
commit
3a4641054e
3 changed files with 19 additions and 76 deletions
5
hmp.c
5
hmp.c
|
@ -1808,7 +1808,6 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
|
|||
{
|
||||
Error *err = NULL;
|
||||
QemuOpts *opts;
|
||||
Visitor *v;
|
||||
Object *obj = NULL;
|
||||
|
||||
opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err);
|
||||
|
@ -1817,9 +1816,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
|
|||
return;
|
||||
}
|
||||
|
||||
v = opts_visitor_new(opts);
|
||||
obj = user_creatable_add(qdict, v, &err);
|
||||
visit_free(v);
|
||||
obj = user_creatable_add_opts(opts, &err);
|
||||
qemu_opts_del(opts);
|
||||
|
||||
if (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue