aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-04-15 10:30:47 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-04-30 06:51:15 +0200
commit7b1cd1c65abad70b26fbe9b11991bd88f0d956e1 (patch)
tree33210bd085fd63afb53ef3db5319f524a8e325f5 /util
parent2f2ec111795119b2e020bc0cbf4b5f42878574b2 (diff)
downloadqemu-7b1cd1c65abad70b26fbe9b11991bd88f0d956e1.zip
qemu-7b1cd1c65abad70b26fbe9b11991bd88f0d956e1.tar.gz
qemu-7b1cd1c65abad70b26fbe9b11991bd88f0d956e1.tar.bz2
qobject: Eliminate qdict_iter(), use qdict_first(), qdict_next()
qdict_iter() has just three uses and no test coverage. Replace by qdict_first(), qdict_next() for more concise code and less type punning. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200415083048.14339-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-option.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/util/qemu-option.c b/util/qemu-option.c
index 9542988..2784757 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -1013,6 +1013,7 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
OptsFromQDictState state;
Error *local_err = NULL;
QemuOpts *opts;
+ const QDictEntry *entry;
opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1,
&local_err);
@@ -1025,7 +1026,14 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
state.errp = &local_err;
state.opts = opts;
- qdict_iter(qdict, qemu_opts_from_qdict_1, &state);
+
+ for (entry = qdict_first(qdict);
+ entry;
+ entry = qdict_next(qdict, entry)) {
+ qemu_opts_from_qdict_1(qdict_entry_key(entry),
+ qdict_entry_value(entry),
+ &state);
+ }
if (local_err) {
error_propagate(errp, local_err);
qemu_opts_del(opts);