Split out parts of the config parsing code to make the parent function easier to read. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_conf.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index b5024705d8..d3f266e338 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -423,6 +423,28 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs, } +static int +virQEMUDriverConfigLoadSPICEEntry(virQEMUDriverConfigPtr cfg, + virConfPtr conf) +{ + if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) + return -1; + if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spiceTLSx509certdir) < 0) + return -1; + if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0) + return -1; + if (virConfGetValueString(conf, "spice_sasl_dir", &cfg->spiceSASLdir) < 0) + return -1; + if (virConfGetValueString(conf, "spice_listen", &cfg->spiceListen) < 0) + return -1; + if (virConfGetValueString(conf, "spice_password", &cfg->spicePassword) < 0) + return -1; + if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAutoUnixSocket) < 0) + return -1; + + return 0; +} + static int virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) @@ -988,21 +1010,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, if (virConfGetValueBool(conf, "nographics_allow_host_audio", &cfg->nogfxAllowHostAudio) < 0) goto cleanup; - - if (virConfGetValueBool(conf, "spice_tls", &cfg->spiceTLS) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_tls_x509_cert_dir", &cfg->spiceTLSx509certdir) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_sasl", &cfg->spiceSASL) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_sasl_dir", &cfg->spiceSASLdir) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_listen", &cfg->spiceListen) < 0) - goto cleanup; - if (virConfGetValueString(conf, "spice_password", &cfg->spicePassword) < 0) - goto cleanup; - if (virConfGetValueBool(conf, "spice_auto_unix_socket", &cfg->spiceAutoUnixSocket) < 0) - goto cleanup; + if (virQEMUDriverConfigLoadSPICEEntry(cfg, conf) < 0) goto cleanup; if (virQEMUDriverConfigLoadSpecificTLSEntry(cfg, conf) < 0) -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list