conf: minor indentation cleanups

On few places there are too many levels of indentation when some of
them can be fixed with negating the option they are in or omitting
useless condition altogether.
This commit is contained in:
Martin Kletzander 2012-12-17 16:02:14 +01:00
parent b72c97e732
commit 7affb25be9

View File

@ -9181,21 +9181,22 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
} }
for (i = 0; i < def->vcpus; i++) { for (i = 0; i < def->vcpus; i++) {
if (!virDomainVcpuPinIsDuplicate(def->cputune.vcpupin, if (virDomainVcpuPinIsDuplicate(def->cputune.vcpupin,
def->cputune.nvcpupin, def->cputune.nvcpupin,
i)) { i))
virDomainVcpuPinDefPtr vcpupin = NULL; continue;
if (VIR_ALLOC(vcpupin) < 0) { virDomainVcpuPinDefPtr vcpupin = NULL;
virReportOOMError();
goto error;
}
vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN); if (VIR_ALLOC(vcpupin) < 0) {
virBitmapCopy(vcpupin->cpumask, def->cpumask); virReportOOMError();
vcpupin->vcpuid = i; goto error;
def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
} }
vcpupin->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
virBitmapCopy(vcpupin->cpumask, def->cpumask);
vcpupin->vcpuid = i;
def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
} }
} }
@ -14100,31 +14101,29 @@ virDomainDefFormatInternal(virDomainDefPtr def,
"</emulator_quota>\n", "</emulator_quota>\n",
def->cputune.emulator_quota); def->cputune.emulator_quota);
if (def->cputune.vcpupin) { for (i = 0; i < def->cputune.nvcpupin; i++) {
for (i = 0; i < def->cputune.nvcpupin; i++) { /* Ignore the vcpupin which inherit from "cpuset"
/* Ignore the vcpupin which inherit from "cpuset" * of "<vcpu>."
* of "<vcpu>." */
*/ if (def->cpumask &&
if (def->cpumask && virBitmapEqual(def->cpumask,
virBitmapEqual(def->cpumask, def->cputune.vcpupin[i]->cpumask))
def->cputune.vcpupin[i]->cpumask)) continue;
continue;
virBufferAsprintf(buf, " <vcpupin vcpu='%u' ", virBufferAsprintf(buf, " <vcpupin vcpu='%u' ",
def->cputune.vcpupin[i]->vcpuid); def->cputune.vcpupin[i]->vcpuid);
char *cpumask = NULL; char *cpumask = NULL;
cpumask = virBitmapFormat(def->cputune.vcpupin[i]->cpumask); cpumask = virBitmapFormat(def->cputune.vcpupin[i]->cpumask);
if (cpumask == NULL) { if (cpumask == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to format cpuset for vcpupin")); "%s", _("failed to format cpuset for vcpupin"));
goto cleanup; goto cleanup;
}
virBufferAsprintf(buf, "cpuset='%s'/>\n", cpumask);
VIR_FREE(cpumask);
} }
virBufferAsprintf(buf, "cpuset='%s'/>\n", cpumask);
VIR_FREE(cpumask);
} }
if (def->cputune.emulatorpin) { if (def->cputune.emulatorpin) {