virDomainDefPtr def,
virDomainXMLOptionPtr xmlopt)
{
- char *buf;
+ g_autofree char *buf = NULL;
int hostcpus;
PRL_UINT32 cpuCount;
PRL_RESULT pret;
- int ret = -1;
if ((hostcpus = virHostCPUGetCount()) < 0)
- goto cleanup;
+ return -1;
/* get number of CPUs */
pret = PrlVmCfg_GetCpuCount(sdkdom, &cpuCount);
- prlsdkCheckRetGoto(pret, cleanup);
+ prlsdkCheckRetExit(pret, -1);
if (cpuCount > hostcpus)
cpuCount = hostcpus;
if (virDomainDefSetVcpusMax(def, cpuCount, xmlopt) < 0)
- goto cleanup;
+ return -1;
if (virDomainDefSetVcpus(def, cpuCount) < 0)
- goto cleanup;
+ return -1;
if (!(buf = prlsdkGetStringParamVar(PrlVmCfg_GetCpuMask, sdkdom)))
- goto cleanup;
+ return -1;
if (strlen(buf) == 0) {
if (!(def->cpumask = virBitmapNew(hostcpus)))
- goto cleanup;
+ return -1;
virBitmapSetAll(def->cpumask);
} else {
if (virBitmapParse(buf, &def->cpumask, hostcpus) < 0)
- goto cleanup;
+ return -1;
}
- ret = 0;
- cleanup:
- VIR_FREE(buf);
- return ret;
+ return 0;
}
static int