
On Tuesday, 9 April 2019 16:52:56 CEST Michal Privoznik wrote:
This part of the code will be reused later.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_firmware.c | 47 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 065e0d11aa..8e9a225982 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1054,6 +1054,34 @@ qemuFirmwareFetchConfigs(char ***firmwares, }
+static bool +qemuFirmwareMatchesMachineArch(const qemuFirmware *fw, + const char *machine, + virArch arch) +{ + size_t i; + + for (i = 0; i < fw->ntargets; i++) { + size_t j; + + if (arch != fw->targets[i]->architecture) + continue; + + for (j = 0; j < fw->targets[i]->nmachines; j++) { + if (fnmatch(fw->targets[i]->machines[j], machine, 0) == 0) + break; + }
Considering this is now an own function, this can just return directly, removing ...
+ + if (j == fw->targets[i]->nmachines) + continue; + + break;
... these bits, and ...
+ } + + return i != fw->ntargets;
... return false here. Just a suggestion though. -- Pino Toscano