diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-03-12 08:40:25 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-06-09 07:40:23 +0200 |
commit | 71df1d833776647fc12f5bbcd6d6fe4c5e931094 (patch) | |
tree | 84d2741b80f2e7ed1eaff0e25d0fc93d44cd09de /util/qemu-option.c | |
parent | 1640b200d53e3d981f12a192fe84b7bb7958c065 (diff) |
QemuOpts: Convert qemu_opt_foreach() to Error
Retain the function value for now, to permit selective conversion of
its callers.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'util/qemu-option.c')
-rw-r--r-- | util/qemu-option.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/util/qemu-option.c b/util/qemu-option.c index 296e2b3fae..840f5f7a5b 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -597,20 +597,23 @@ void qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val, } /** - * For each member of @opts, call @func(name, value, @opaque). + * For each member of @opts, call @func(@opaque, name, value, @errp). + * @func() may store an Error through @errp, but must return non-zero then. * When @func() returns non-zero, break the loop and return that value. * Return zero when the loop completes. */ -int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque) +int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque, + Error **errp) { QemuOpt *opt; int rc; QTAILQ_FOREACH(opt, &opts->head, next) { - rc = func(opt->name, opt->str, opaque); + rc = func(opaque, opt->name, opt->str, errp); if (rc) { return rc; } + assert(!errp || !*errp); } return 0; } |