提交 28934e0c 编写于 作者: E Eric Blake 提交者: Markus Armbruster

QemuOpts: Simplify qemu_opts_to_qdict()

Noticed while investigating Coccinelle cleanups. There is no need
for a temporary variable when we can use the new macro to do the
same thing with less typing.
Signed-off-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-9-eblake@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 ff6ed714
...@@ -1054,7 +1054,6 @@ void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp) ...@@ -1054,7 +1054,6 @@ void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp)
QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict) QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict)
{ {
QemuOpt *opt; QemuOpt *opt;
QObject *val;
if (!qdict) { if (!qdict) {
qdict = qdict_new(); qdict = qdict_new();
...@@ -1063,8 +1062,7 @@ QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict) ...@@ -1063,8 +1062,7 @@ QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict)
qdict_put_str(qdict, "id", opts->id); qdict_put_str(qdict, "id", opts->id);
} }
QTAILQ_FOREACH(opt, &opts->head, next) { QTAILQ_FOREACH(opt, &opts->head, next) {
val = QOBJECT(qstring_from_str(opt->str)); qdict_put_str(qdict, opt->name, opt->str);
qdict_put_obj(qdict, opt->name, val);
} }
return qdict; return qdict;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册