On 1/15/19 8:23 AM, Ján Tomko wrote:
Split out parts of the config parsing code to make
the parent function easier to read.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_conf.c | 49 +++++++++++++++++++++++++++++---------------
1 file changed, 32 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ca31a222e8..29f948346d 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -423,6 +423,37 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
}
+static int
+virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg,
+ virConfPtr conf)
+{
+ char **nvram = NULL;
VIR_AUTOPTR(virString)
+ int ret = -1;
+ size_t i;
+
+ if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0)
+ goto cleanup;
+ if (nvram) {
+ virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
+
+ cfg->nfirmwares = virStringListLength((const char *const *)nvram);
+ if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) <
0)
+ goto cleanup;
+
+ for (i = 0; nvram[i] != NULL; i++) {
+ if (VIR_ALLOC(cfg->firmwares[i]) < 0)
+ goto cleanup;
+ if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0)
+ goto cleanup;
+ }
+ }
+
+ ret = 0;
+ cleanup:
+ virStringListFree(nvram);
+ return ret;
+}
+
blank line
Reviewed-by: John Ferlan <jferlan(a)redhat.com>
John