From: Markus Armbruster Date: Fri, 29 Jan 2010 18:48:56 +0000 (+0100) Subject: qemu-option: Make qemu_opts_foreach() accumulate return values X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~8865 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a2594ddd35de7ae7c8cd9c6828cfe72245e6dc5;p=sdk%2Femulator%2Fqemu.git qemu-option: Make qemu_opts_foreach() accumulate return values Return the bitwise inclusive or of all return values instead of the last call's value. This lets you find out whether any of the calls returned a non-zero value. No functional change, as existing users either don't care for the value, or pass non-zero abort_on_failure, which breaks the loop on the first non-zero return value. Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori --- diff --git a/qemu-option.c b/qemu-option.c index 24392fc..a52a4c4a 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -814,7 +814,7 @@ int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int rc = 0; QTAILQ_FOREACH(opts, &list->head, next) { - rc = func(opts, opaque); + rc |= func(opts, opaque); if (abort_on_failure && rc != 0) break; }