From 583022e52ee090eded9ad7b66fc20899faa4c311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 26 May 2017 18:13:59 +0200 Subject: [PATCH] conf: eliminate monster condition in virDomainControllerDefFormat Move most of the subelement formatting out of the giant if. --- src/conf/domain_conf.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3e884225b3..1ab63607f5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21479,11 +21479,7 @@ virDomainControllerDefFormat(virBufferPtr buf, break; } - if (pciModel || pciTarget || - def->queues || def->cmd_per_lun || def->max_sectors || def->ioeventfd || - def->iothread || - virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) { - + if (pciModel || pciTarget) { if (pciModel) { modelName = virDomainControllerPCIModelNameTypeToString(def->opts.pciopts.modelName); if (!modelName) { @@ -21520,17 +21516,17 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferAddLit(&childBuf, "\n"); } } + } - virDomainControllerDriverFormat(&childBuf, def); + virDomainControllerDriverFormat(&childBuf, def); - if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && - virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && + virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) + return -1; - if (pcihole64) { - virBufferAsprintf(&childBuf, "%lu\n", def->opts.pciopts.pcihole64size); - } + if (pcihole64) { + virBufferAsprintf(&childBuf, "%lu\n", def->opts.pciopts.pcihole64size); } if (virBufferUse(&childBuf)) {