mirror of https://gitee.com/openkylin/libvirt.git
virBitmapNew: Don't check return value
Remove return value check from all callers. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
bab5a79d6a
commit
cb6fdb0125
|
@ -1411,9 +1411,7 @@ virCapabilitiesHostNUMAGetCpus(virCapsHostNUMAPtr caps,
|
|||
unsigned int maxcpu = virCapabilitiesHostNUMAGetMaxcpu(caps);
|
||||
ssize_t node = -1;
|
||||
|
||||
if (!(ret = virBitmapNew(maxcpu + 1)))
|
||||
return NULL;
|
||||
|
||||
ret = virBitmapNew(maxcpu + 1);
|
||||
|
||||
while ((node = virBitmapNextSetBit(nodemask, node)) >= 0) {
|
||||
if (virCapabilitiesHostNUMAGetCellCpus(caps, node, ret) < 0) {
|
||||
|
@ -1591,8 +1589,7 @@ virCapabilitiesHostNUMAInitFake(virCapsHostNUMAPtr caps)
|
|||
cpus[cid].die_id = 0;
|
||||
cpus[cid].socket_id = s;
|
||||
cpus[cid].core_id = c;
|
||||
if (!(cpus[cid].siblings = virBitmapNew(ncpus)))
|
||||
goto error;
|
||||
cpus[cid].siblings = virBitmapNew(ncpus);
|
||||
virBitmapCopy(cpus[cid].siblings, siblings);
|
||||
cid++;
|
||||
}
|
||||
|
|
|
@ -323,8 +323,7 @@ virDomainCheckpointAlignDisks(virDomainCheckpointDefPtr def)
|
|||
if (!def->ndisks)
|
||||
checkpoint_default = VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP;
|
||||
|
||||
if (!(map = virBitmapNew(def->parent.dom->ndisks)))
|
||||
goto cleanup;
|
||||
map = virBitmapNew(def->parent.dom->ndisks);
|
||||
|
||||
/* Double check requested disks. */
|
||||
for (i = 0; i < def->ndisks; i++) {
|
||||
|
|
|
@ -1595,8 +1595,7 @@ virDomainVirtioSerialAddrSetAddController(virDomainVirtioSerialAddrSetPtr addrs,
|
|||
if (VIR_ALLOC(cnt) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(cnt->ports = virBitmapNew(ports)))
|
||||
goto cleanup;
|
||||
cnt->ports = virBitmapNew(ports);
|
||||
cnt->idx = cont->idx;
|
||||
|
||||
if ((insertAt = virDomainVirtioSerialAddrPlaceController(addrs, cnt)) < -1)
|
||||
|
@ -2043,8 +2042,7 @@ virDomainUSBAddressHubNew(size_t nports)
|
|||
if (VIR_ALLOC(hub) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(hub->portmap = virBitmapNew(nports)))
|
||||
goto cleanup;
|
||||
hub->portmap = virBitmapNew(nports);
|
||||
|
||||
if (VIR_ALLOC_N(hub->ports, nports) < 0)
|
||||
goto cleanup;
|
||||
|
|
|
@ -2032,12 +2032,9 @@ virDomainDefGetVcpus(const virDomainDef *def)
|
|||
virBitmapPtr
|
||||
virDomainDefGetOnlineVcpumap(const virDomainDef *def)
|
||||
{
|
||||
virBitmapPtr ret = NULL;
|
||||
virBitmapPtr ret = virBitmapNew(def->maxvcpus);
|
||||
size_t i;
|
||||
|
||||
if (!(ret = virBitmapNew(def->maxvcpus)))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < def->maxvcpus; i++) {
|
||||
if (def->vcpus[i]->online)
|
||||
ignore_value(virBitmapSetBit(ret, i));
|
||||
|
@ -3311,8 +3308,7 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def,
|
|||
return 0;
|
||||
|
||||
/* iothread's are numbered starting at 1, account for that */
|
||||
if (!(thrmap = virBitmapNew(iothreads + 1)))
|
||||
return -1;
|
||||
thrmap = virBitmapNew(iothreads + 1);
|
||||
virBitmapSetAll(thrmap);
|
||||
|
||||
/* Clear 0 since we don't use it, then mark those which are
|
||||
|
@ -4505,8 +4501,8 @@ virDomainDefRejectDuplicateControllers(virDomainDefPtr def)
|
|||
max_idx[VIR_DOMAIN_CONTROLLER_TYPE_USB] = -1;
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_CONTROLLER_TYPE_LAST; i++) {
|
||||
if (max_idx[i] >= 0 && !(bitmaps[i] = virBitmapNew(max_idx[i] + 1)))
|
||||
goto cleanup;
|
||||
if (max_idx[i] >= 0)
|
||||
bitmaps[i] = virBitmapNew(max_idx[i] + 1);
|
||||
nbitmaps++;
|
||||
}
|
||||
|
||||
|
|
|
@ -1143,10 +1143,8 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
|
|||
if ((n = virXPathNodeSet("./feature", ctxt, &nodes)) < 0)
|
||||
goto out;
|
||||
|
||||
if (n > 0) {
|
||||
if (!(net->features = virBitmapNew(VIR_NET_DEV_FEAT_LAST)))
|
||||
goto out;
|
||||
}
|
||||
if (n > 0)
|
||||
net->features = virBitmapNew(VIR_NET_DEV_FEAT_LAST);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
int val;
|
||||
|
|
|
@ -1444,8 +1444,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
|
|||
if (!def->target.compat)
|
||||
def->target.compat = g_strdup("1.1");
|
||||
|
||||
if (!(def->target.features = virBitmapNew(VIR_STORAGE_FILE_FEATURE_LAST)))
|
||||
return NULL;
|
||||
def->target.features = virBitmapNew(VIR_STORAGE_FILE_FEATURE_LAST);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
int f = virStorageFileFeatureTypeFromString((const char*)nodes[i]->name);
|
||||
|
|
|
@ -110,8 +110,7 @@ virNetworkObjNew(void)
|
|||
if (!(obj = virObjectLockableNew(virNetworkObjClass)))
|
||||
return NULL;
|
||||
|
||||
if (!(obj->classIdMap = virBitmapNew(INIT_CLASS_ID_BITMAP_SIZE)))
|
||||
goto error;
|
||||
obj->classIdMap = virBitmapNew(INIT_CLASS_ID_BITMAP_SIZE);
|
||||
|
||||
/* The first three class IDs are already taken */
|
||||
if (virBitmapSetBitExpand(obj->classIdMap, 0) < 0 ||
|
||||
|
|
|
@ -296,10 +296,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
|
|||
cpus[node][nr_cpus_node[node]-1].core_id = cpu_topo[i].core;
|
||||
/* Allocate the siblings maps. We will be filling them later */
|
||||
cpus[node][nr_cpus_node[node]-1].siblings = virBitmapNew(nr_cpus);
|
||||
if (!cpus[node][nr_cpus_node[node]-1].siblings) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Let's now populate the siblings bitmaps */
|
||||
|
|
|
@ -2571,8 +2571,7 @@ libxlDomainGetVcpuPinInfo(virDomainPtr dom, int ncpumaps,
|
|||
/* Make sure coverity knows targetDef is valid at this point. */
|
||||
sa_assert(targetDef);
|
||||
|
||||
if (!(hostcpus = virBitmapNew(libxl_get_max_cpus(cfg->ctx))))
|
||||
goto cleanup;
|
||||
hostcpus = virBitmapNew(libxl_get_max_cpus(cfg->ctx));
|
||||
virBitmapSetAll(hostcpus);
|
||||
|
||||
ret = virDomainDefGetVcpuPinInfoHelper(targetDef, maplen, ncpumaps, cpumaps,
|
||||
|
@ -4952,8 +4951,7 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
|
|||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
if (!(nodes = virBitmapNew(numnodes)))
|
||||
goto cleanup;
|
||||
nodes = virBitmapNew(numnodes);
|
||||
|
||||
rc = libxl_domain_get_nodeaffinity(cfg->ctx,
|
||||
vm->def->id,
|
||||
|
|
|
@ -756,9 +756,6 @@ static int virLXCControllerSetupCpuAffinity(virLXCControllerPtr ctrl)
|
|||
maxcpu = hostcpus;
|
||||
|
||||
cpumap = virBitmapNew(maxcpu);
|
||||
if (!cpumap)
|
||||
return -1;
|
||||
|
||||
cpumapToSet = cpumap;
|
||||
|
||||
if (ctrl->def->cpumask) {
|
||||
|
|
|
@ -1800,8 +1800,7 @@ virQEMUCapsNew(void)
|
|||
return NULL;
|
||||
|
||||
qemuCaps->invalidation = true;
|
||||
if (!(qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST)))
|
||||
goto error;
|
||||
qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST);
|
||||
|
||||
if (!(qemuCaps->domCapsCache = virQEMUDomainCapsCacheNew()))
|
||||
goto error;
|
||||
|
|
|
@ -278,8 +278,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged,
|
|||
cfg->glusterDebugLevel = 4;
|
||||
cfg->stdioLogD = true;
|
||||
|
||||
if (!(cfg->namespaces = virBitmapNew(QEMU_DOMAIN_NS_LAST)))
|
||||
return NULL;
|
||||
cfg->namespaces = virBitmapNew(QEMU_DOMAIN_NS_LAST);
|
||||
|
||||
if (privileged &&
|
||||
qemuDomainNamespaceAvailable(QEMU_DOMAIN_NS_MOUNT) &&
|
||||
|
|
|
@ -3056,13 +3056,10 @@ qemuDomainUSBAddressAddHubs(virDomainDefPtr def)
|
|||
static virBitmapPtr
|
||||
qemuDomainGetMemorySlotMap(const virDomainDef *def)
|
||||
{
|
||||
virBitmapPtr ret;
|
||||
virBitmapPtr ret = virBitmapNew(def->mem.memory_slots);
|
||||
virDomainMemoryDefPtr mem;
|
||||
size_t i;
|
||||
|
||||
if (!(ret = virBitmapNew(def->mem.memory_slots)))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < def->nmems; i++) {
|
||||
mem = def->mems[i];
|
||||
|
||||
|
|
|
@ -19280,18 +19280,13 @@ qemuDomainGetGuestVcpusParams(virTypedParameterPtr *params,
|
|||
virTypedParameterPtr par = NULL;
|
||||
int npar = 0;
|
||||
int maxpar = 0;
|
||||
virBitmapPtr vcpus = NULL;
|
||||
virBitmapPtr online = NULL;
|
||||
virBitmapPtr offlinable = NULL;
|
||||
virBitmapPtr vcpus = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
||||
virBitmapPtr online = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
||||
virBitmapPtr offlinable = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
||||
g_autofree char *tmp = NULL;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
if (!(vcpus = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID)) ||
|
||||
!(online = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID)) ||
|
||||
!(offlinable = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID)))
|
||||
goto cleanup;
|
||||
|
||||
for (i = 0; i < ninfo; i++) {
|
||||
if (virBitmapSetBit(vcpus, info[i].id) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
|
|
@ -6150,8 +6150,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr def,
|
|||
unsigned int curvcpus = virDomainDefGetVcpus(def);
|
||||
ssize_t i;
|
||||
|
||||
if (!(ret = virBitmapNew(maxvcpus)))
|
||||
return NULL;
|
||||
ret = virBitmapNew(maxvcpus);
|
||||
|
||||
if (nvcpus > curvcpus) {
|
||||
*enable = true;
|
||||
|
|
|
@ -1122,9 +1122,8 @@ qemuMigrationCookieCapsXMLParse(xmlXPathContextPtr ctxt)
|
|||
if (VIR_ALLOC(caps) < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(caps->supported = virBitmapNew(QEMU_MIGRATION_CAP_LAST)) ||
|
||||
!(caps->automatic = virBitmapNew(QEMU_MIGRATION_CAP_LAST)))
|
||||
goto cleanup;
|
||||
caps->supported = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
caps->automatic = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
|
||||
if ((n = virXPathNodeSet("./capabilities[1]/cap", ctxt, &nodes)) < 0)
|
||||
goto cleanup;
|
||||
|
|
|
@ -224,12 +224,9 @@ G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LA
|
|||
virBitmapPtr
|
||||
qemuMigrationParamsGetAlwaysOnCaps(qemuMigrationParty party)
|
||||
{
|
||||
virBitmapPtr caps = NULL;
|
||||
virBitmapPtr caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
size_t i;
|
||||
|
||||
if (!(caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST)))
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS(qemuMigrationParamsAlwaysOn); i++) {
|
||||
if (!(qemuMigrationParamsAlwaysOn[i].party & party))
|
||||
continue;
|
||||
|
@ -248,8 +245,7 @@ qemuMigrationParamsNew(void)
|
|||
|
||||
params = g_new0(qemuMigrationParams, 1);
|
||||
|
||||
if (!(params->caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST)))
|
||||
return NULL;
|
||||
params->caps = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
|
||||
return g_steal_pointer(¶ms);
|
||||
}
|
||||
|
@ -1373,8 +1369,6 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver,
|
|||
return 0;
|
||||
|
||||
priv->migrationCaps = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
if (!priv->migrationCaps)
|
||||
return -1;
|
||||
|
||||
for (capStr = caps; *capStr; capStr++) {
|
||||
int cap = qemuMigrationCapabilityTypeFromString(*capStr);
|
||||
|
@ -1389,8 +1383,6 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver,
|
|||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
|
||||
migEvent = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
if (!migEvent)
|
||||
return -1;
|
||||
|
||||
ignore_value(virBitmapSetBit(migEvent, QEMU_MIGRATION_CAP_EVENTS));
|
||||
|
||||
|
|
|
@ -1937,8 +1937,7 @@ qemuMonitorGetCpuHalted(qemuMonitorPtr mon,
|
|||
if (rc < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(ret = virBitmapNew(maxvcpus)))
|
||||
goto cleanup;
|
||||
ret = virBitmapNew(maxvcpus);
|
||||
|
||||
for (i = 0; i < ncpuentries; i++) {
|
||||
if (cpuentries[i].halted)
|
||||
|
|
|
@ -799,9 +799,8 @@ qemuDomainEnableNamespace(virDomainObjPtr vm,
|
|||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
if (!priv->namespaces &&
|
||||
!(priv->namespaces = virBitmapNew(QEMU_DOMAIN_NS_LAST)))
|
||||
return -1;
|
||||
if (!priv->namespaces)
|
||||
priv->namespaces = virBitmapNew(QEMU_DOMAIN_NS_LAST);
|
||||
|
||||
if (virBitmapSetBit(priv->namespaces, ns) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
|
|
@ -5870,12 +5870,9 @@ qemuProcessValidateHotpluggableVcpus(virDomainDefPtr def)
|
|||
unsigned int maxvcpus = virDomainDefGetVcpusMax(def);
|
||||
size_t i = 0;
|
||||
size_t j;
|
||||
virBitmapPtr ordermap = NULL;
|
||||
virBitmapPtr ordermap = virBitmapNew(maxvcpus + 1);
|
||||
int ret = -1;
|
||||
|
||||
if (!(ordermap = virBitmapNew(maxvcpus + 1)))
|
||||
goto cleanup;
|
||||
|
||||
/* validate:
|
||||
* - all hotpluggable entities to be hotplugged have the correct data
|
||||
* - vcpus belonging to a hotpluggable entity share configuration
|
||||
|
|
|
@ -83,9 +83,7 @@ qemuSlirpNew(void)
|
|||
{
|
||||
g_autoptr(qemuSlirp) slirp = g_new0(qemuSlirp, 1);
|
||||
|
||||
if (!(slirp->features = virBitmapNew(QEMU_SLIRP_FEATURE_LAST)))
|
||||
return NULL;
|
||||
|
||||
slirp->features = virBitmapNew(QEMU_SLIRP_FEATURE_LAST);
|
||||
slirp->pid = (pid_t)-1;
|
||||
slirp->fd[0] = slirp->fd[1] = -1;
|
||||
|
||||
|
|
|
@ -163,8 +163,7 @@ qemuSnapshotCreateInactiveExternal(virQEMUDriverPtr driver,
|
|||
if (!(qemuImgPath = qemuFindQemuImgBinary(driver)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(created = virBitmapNew(snapdef->ndisks)))
|
||||
goto cleanup;
|
||||
created = virBitmapNew(snapdef->ndisks);
|
||||
|
||||
/* If reuse is true, then qemuSnapshotPrepare already
|
||||
* ensured that the new files exist, and it was up to the user to
|
||||
|
|
|
@ -1360,8 +1360,6 @@ testOpenDefault(virConnectPtr conn)
|
|||
}
|
||||
for (i = 0; i < 16; i++) {
|
||||
virBitmapPtr siblings = virBitmapNew(16);
|
||||
if (!siblings)
|
||||
goto error;
|
||||
ignore_value(virBitmapSetBit(siblings, i));
|
||||
privconn->cells[i / 8].cpus[(i % 8)].id = i;
|
||||
privconn->cells[i / 8].cpus[(i % 8)].socket_id = i / 8;
|
||||
|
@ -2788,8 +2786,7 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom,
|
|||
} else if (def->cpumask) {
|
||||
cpumask = def->cpumask;
|
||||
} else {
|
||||
if (!(bitmap = virBitmapNew(hostcpus)))
|
||||
goto cleanup;
|
||||
bitmap = virBitmapNew(hostcpus);
|
||||
virBitmapSetAll(bitmap);
|
||||
cpumask = bitmap;
|
||||
}
|
||||
|
@ -2966,9 +2963,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
|
|||
statbase = g_get_real_time();
|
||||
|
||||
hostcpus = VIR_NODEINFO_MAXCPUS(privconn->nodeInfo);
|
||||
if (!(allcpumap = virBitmapNew(hostcpus)))
|
||||
goto cleanup;
|
||||
|
||||
allcpumap = virBitmapNew(hostcpus);
|
||||
virBitmapSetAll(allcpumap);
|
||||
|
||||
/* Clamp to actual number of vcpus */
|
||||
|
@ -3081,8 +3076,7 @@ testDomainGetVcpuPinInfo(virDomainPtr dom,
|
|||
if (!(def = virDomainObjGetOneDef(privdom, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(hostcpus = virBitmapNew(VIR_NODEINFO_MAXCPUS(driver->nodeInfo))))
|
||||
goto cleanup;
|
||||
hostcpus = virBitmapNew(VIR_NODEINFO_MAXCPUS(driver->nodeInfo));
|
||||
virBitmapSetAll(hostcpus);
|
||||
|
||||
ret = virDomainDefGetVcpuPinInfoHelper(def, maplen, ncpumaps, cpumaps,
|
||||
|
|
|
@ -433,8 +433,7 @@ virBitmapParseSeparator(const char *str,
|
|||
size_t i;
|
||||
int start, last;
|
||||
|
||||
if (!(*bitmap = virBitmapNew(bitmapSize)))
|
||||
return -1;
|
||||
*bitmap = virBitmapNew(bitmapSize);
|
||||
|
||||
if (!str)
|
||||
goto error;
|
||||
|
@ -664,10 +663,7 @@ virBitmapParseUnlimited(const char *str)
|
|||
virBitmapPtr
|
||||
virBitmapNewCopy(virBitmapPtr src)
|
||||
{
|
||||
virBitmapPtr dst;
|
||||
|
||||
if ((dst = virBitmapNew(src->nbits)) == NULL)
|
||||
return NULL;
|
||||
virBitmapPtr dst = virBitmapNew(src->nbits);
|
||||
|
||||
if (virBitmapCopy(dst, src) != 0) {
|
||||
virBitmapFree(dst);
|
||||
|
@ -699,8 +695,6 @@ virBitmapNewData(const void *data,
|
|||
const unsigned char *bytes = data;
|
||||
|
||||
bitmap = virBitmapNew(len * CHAR_BIT);
|
||||
if (!bitmap)
|
||||
return NULL;
|
||||
|
||||
/* le64toh is not available, so we do the conversion by hand */
|
||||
p = bitmap->map;
|
||||
|
@ -1116,8 +1110,6 @@ virBitmapNewString(const char *string)
|
|||
}
|
||||
|
||||
bitmap = virBitmapNew(len * 4);
|
||||
if (!bitmap)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
unsigned long nibble = g_ascii_xdigit_value(string[len - i - 1]);
|
||||
|
|
|
@ -571,8 +571,7 @@ virCommandMassClose(virCommandPtr cmd,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!(fds = virBitmapNew(openmax)))
|
||||
return -1;
|
||||
fds = virBitmapNew(openmax);
|
||||
|
||||
# ifdef __linux__
|
||||
if (virCommandMassCloseGetFDsLinux(cmd, fds) < 0)
|
||||
|
|
|
@ -768,14 +768,9 @@ dnsmasqCapsNewEmpty(const char *binaryPath)
|
|||
return NULL;
|
||||
if (!(caps = virObjectNew(dnsmasqCapsClass)))
|
||||
return NULL;
|
||||
if (!(caps->flags = virBitmapNew(DNSMASQ_CAPS_LAST)))
|
||||
goto error;
|
||||
caps->flags = virBitmapNew(DNSMASQ_CAPS_LAST);
|
||||
caps->binaryPath = g_strdup(binaryPath ? binaryPath : DNSMASQ);
|
||||
return caps;
|
||||
|
||||
error:
|
||||
virObjectUnref(caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dnsmasqCapsPtr
|
||||
|
|
|
@ -268,8 +268,7 @@ virHostCPUGetSiblingsList(unsigned int cpu)
|
|||
if (rv == -2) {
|
||||
/* If the file doesn't exist, the threadis its only sibling */
|
||||
ret = virBitmapNew(cpu + 1);
|
||||
if (ret)
|
||||
ignore_value(virBitmapSetBit(ret, cpu));
|
||||
ignore_value(virBitmapSetBit(ret, cpu));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -332,8 +331,7 @@ virHostCPUParseNode(const char *node,
|
|||
goto cleanup;
|
||||
|
||||
/* Keep track of the CPUs that belong to the current node */
|
||||
if (!(node_cpus_map = virBitmapNew(npresent_cpus)))
|
||||
goto cleanup;
|
||||
node_cpus_map = virBitmapNew(npresent_cpus);
|
||||
|
||||
/* enumerate sockets in the node */
|
||||
sockets_map = virBitmapNew(0);
|
||||
|
@ -1119,9 +1117,7 @@ virHostCPUGetAvailableCPUsBitmap(void)
|
|||
if ((hostcpus = virHostCPUGetCount()) < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(bitmap = virBitmapNew(hostcpus)))
|
||||
return NULL;
|
||||
|
||||
bitmap = virBitmapNew(hostcpus);
|
||||
virBitmapSetAll(bitmap);
|
||||
}
|
||||
|
||||
|
|
|
@ -3331,8 +3331,7 @@ virNetDevGetFeatures(const char *ifname,
|
|||
struct ifreq ifr;
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
|
||||
if (!(*out = virBitmapNew(VIR_NET_DEV_FEAT_LAST)))
|
||||
return -1;
|
||||
*out = virBitmapNew(VIR_NET_DEV_FEAT_LAST);
|
||||
|
||||
if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
|
||||
return -1;
|
||||
|
|
|
@ -273,8 +273,7 @@ virNumaGetNodeCPUs(int node,
|
|||
return -2;
|
||||
}
|
||||
|
||||
if (!(cpumap = virBitmapNew(max_n_cpus)))
|
||||
return -1;
|
||||
cpumap = virBitmapNew(max_n_cpus);
|
||||
|
||||
for (i = 0; i < max_n_cpus; i++) {
|
||||
if (MASK_CPU_ISSET(mask, i)) {
|
||||
|
@ -1027,8 +1026,7 @@ virNumaGetHostMemoryNodeset(void)
|
|||
if (maxnode < 0)
|
||||
return NULL;
|
||||
|
||||
if (!(nodeset = virBitmapNew(maxnode + 1)))
|
||||
return NULL;
|
||||
nodeset = virBitmapNew(maxnode + 1);
|
||||
|
||||
for (i = 0; i <= maxnode; i++) {
|
||||
if (!virNumaNodeIsAvailable(i))
|
||||
|
|
|
@ -70,13 +70,9 @@ virPortAllocatorNew(void)
|
|||
if (!(pa = virObjectLockableNew(virPortAllocatorClass)))
|
||||
return NULL;
|
||||
|
||||
if (!(pa->bitmap = virBitmapNew(VIR_PORT_ALLOCATOR_NUM_PORTS)))
|
||||
goto error;
|
||||
pa->bitmap = virBitmapNew(VIR_PORT_ALLOCATOR_NUM_PORTS);
|
||||
|
||||
return pa;
|
||||
error:
|
||||
virObjectUnref(pa);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -520,8 +520,7 @@ virProcessGetAffinity(pid_t pid)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(ret = virBitmapNew(ncpus)))
|
||||
goto cleanup;
|
||||
ret = virBitmapNew(ncpus);
|
||||
|
||||
for (i = 0; i < ncpus; i++) {
|
||||
/* coverity[overrun-local] */
|
||||
|
@ -580,8 +579,7 @@ virProcessGetAffinity(pid_t pid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(ret = virBitmapNew(sizeof(mask) * 8)))
|
||||
return NULL;
|
||||
ret = virBitmapNew(sizeof(mask) * 8);
|
||||
|
||||
for (i = 0; i < sizeof(mask) * 8; i++)
|
||||
if (CPU_ISSET(i, &mask))
|
||||
|
|
|
@ -1157,13 +1157,9 @@ virResctrlAllocUpdateMask(virResctrlAllocPtr alloc,
|
|||
cache - a_type->nmasks + 1) < 0)
|
||||
return -1;
|
||||
|
||||
if (!a_type->masks[cache]) {
|
||||
if (!a_type->masks[cache])
|
||||
a_type->masks[cache] = virBitmapNew(virBitmapSize(mask));
|
||||
|
||||
if (!a_type->masks[cache])
|
||||
return -1;
|
||||
}
|
||||
|
||||
return virBitmapCopy(a_type->masks[cache], mask);
|
||||
}
|
||||
|
||||
|
@ -1874,8 +1870,6 @@ virResctrlAllocNewFromInfo(virResctrlInfoPtr info)
|
|||
|
||||
virBitmapFree(mask);
|
||||
mask = virBitmapNew(i_type->bits);
|
||||
if (!mask)
|
||||
goto error;
|
||||
virBitmapSetAll(mask);
|
||||
|
||||
for (k = 0; k <= i_type->max_cache_id; k++) {
|
||||
|
@ -2102,8 +2096,6 @@ virResctrlAllocFindUnused(virResctrlAllocPtr alloc,
|
|||
}
|
||||
|
||||
a_mask = virBitmapNew(i_type->bits);
|
||||
if (!a_mask)
|
||||
return -1;
|
||||
|
||||
for (i = last_pos; i < last_pos + need_bits; i++)
|
||||
ignore_value(virBitmapSetBit(a_mask, i));
|
||||
|
|
|
@ -852,8 +852,7 @@ qcow2GetFeatures(virBitmapPtr *features,
|
|||
if (len < QCOW2v3_HDR_SIZE)
|
||||
return -1;
|
||||
|
||||
if (!(feat = virBitmapNew(VIR_STORAGE_FILE_FEATURE_LAST)))
|
||||
return -1;
|
||||
feat = virBitmapNew(VIR_STORAGE_FILE_FEATURE_LAST);
|
||||
|
||||
/* todo: check for incompatible or autoclear features? */
|
||||
bits = virReadBufInt64BE(buf + QCOW2v3_HDR_FEATURES_COMPATIBLE);
|
||||
|
|
|
@ -1507,8 +1507,6 @@ virVMXParseConfig(virVMXContext *ctx,
|
|||
size_t naffs;
|
||||
|
||||
def->cpumask = virBitmapNew(VIR_DOMAIN_CPUMASK_LEN);
|
||||
if (!def->cpumask)
|
||||
goto cleanup;
|
||||
|
||||
if (!(afflist = virStringSplitCount(sched_cpu_affinity, ",", 0, &naffs)))
|
||||
goto cleanup;
|
||||
|
|
|
@ -1464,8 +1464,7 @@ prlsdkConvertCpuInfo(PRL_HANDLE sdkdom,
|
|||
return -1;
|
||||
|
||||
if (strlen(buf) == 0) {
|
||||
if (!(def->cpumask = virBitmapNew(hostcpus)))
|
||||
return -1;
|
||||
def->cpumask = virBitmapNew(hostcpus);
|
||||
virBitmapSetAll(def->cpumask);
|
||||
} else {
|
||||
if (virBitmapParse(buf, &def->cpumask, hostcpus) < 0)
|
||||
|
|
|
@ -2252,9 +2252,6 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const void *opaque)
|
|||
}
|
||||
|
||||
bitmap = virBitmapNew(QEMU_MIGRATION_CAP_LAST);
|
||||
if (!bitmap)
|
||||
goto cleanup;
|
||||
|
||||
ignore_value(virBitmapSetBit(bitmap, QEMU_MIGRATION_CAP_XBZRLE));
|
||||
if (!(json = qemuMigrationCapsToJSON(bitmap, bitmap)))
|
||||
goto cleanup;
|
||||
|
|
|
@ -832,8 +832,7 @@ int virTestMain(int argc,
|
|||
}
|
||||
}
|
||||
|
||||
if (!(failedTests = virBitmapNew(1)))
|
||||
return EXIT_FAILURE;
|
||||
failedTests = virBitmapNew(1);
|
||||
|
||||
ret = (func)();
|
||||
|
||||
|
@ -980,9 +979,7 @@ virTestCapsBuildNUMATopology(int seq)
|
|||
cell_cpus[core_id].id = id + core_id;
|
||||
cell_cpus[core_id].socket_id = cell_id + seq;
|
||||
cell_cpus[core_id].core_id = id + core_id;
|
||||
if (!(cell_cpus[core_id].siblings =
|
||||
virBitmapNew(MAX_CPUS_IN_CELL)))
|
||||
goto error;
|
||||
cell_cpus[core_id].siblings = virBitmapNew(MAX_CPUS_IN_CELL);
|
||||
ignore_value(virBitmapSetBit(cell_cpus[core_id].siblings, id));
|
||||
}
|
||||
id++;
|
||||
|
@ -997,10 +994,6 @@ virTestCapsBuildNUMATopology(int seq)
|
|||
}
|
||||
|
||||
return g_steal_pointer(&caps);
|
||||
|
||||
error:
|
||||
VIR_FREE(cell_cpus);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static virDomainDefParserConfig virTestGenericDomainDefParserConfig = {
|
||||
|
|
|
@ -61,8 +61,7 @@ test1(const void *data G_GNUC_UNUSED)
|
|||
|
||||
size = 1024;
|
||||
bit = 100;
|
||||
if (!(bitmap = virBitmapNew(size)))
|
||||
return -1;
|
||||
bitmap = virBitmapNew(size);
|
||||
|
||||
if (virBitmapSetBit(bitmap, bit) < 0)
|
||||
return -1;
|
||||
|
@ -165,8 +164,7 @@ test3(const void *data G_GNUC_UNUSED)
|
|||
int size = 5;
|
||||
size_t i;
|
||||
|
||||
if ((bitmap = virBitmapNew(size)) == NULL)
|
||||
return -1;
|
||||
bitmap = virBitmapNew(size);
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
ignore_value(virBitmapSetBit(bitmap, i));
|
||||
|
@ -214,8 +212,6 @@ test4b(const void *data G_GNUC_UNUSED)
|
|||
/* 1. zero set */
|
||||
|
||||
bitmap = virBitmapNew(size);
|
||||
if (!bitmap)
|
||||
return -1;
|
||||
|
||||
if (virBitmapNextSetBit(bitmap, -1) != -1)
|
||||
return -1;
|
||||
|
@ -375,8 +371,6 @@ test6(const void *v G_GNUC_UNUSED)
|
|||
int size = 64;
|
||||
|
||||
bitmap = virBitmapNew(size);
|
||||
if (!bitmap)
|
||||
return -1;
|
||||
|
||||
if (checkBitmap(bitmap, "", -1) < 0)
|
||||
return -1;
|
||||
|
@ -425,8 +419,6 @@ test7(const void *v G_GNUC_UNUSED)
|
|||
|
||||
for (i = 0; i < nmaxBit; i++) {
|
||||
g_autoptr(virBitmap) bitmap = virBitmapNew(maxBit[i]);
|
||||
if (!bitmap)
|
||||
return -1;
|
||||
|
||||
if (virBitmapIsAllSet(bitmap))
|
||||
return -1;
|
||||
|
|
|
@ -6840,8 +6840,7 @@ virshDomainGetVcpuBitmap(vshControl *ctl,
|
|||
if (curvcpus == 0)
|
||||
curvcpus = maxvcpus;
|
||||
|
||||
if (!(ret = virBitmapNew(maxvcpus)))
|
||||
goto cleanup;
|
||||
ret = virBitmapNew(maxvcpus);
|
||||
|
||||
if ((nnodes = virXPathNodeSet("/domain/vcpus/vcpu", ctxt, &nodes)) <= 0) {
|
||||
/* if the specific vcpu state is missing provide a fallback */
|
||||
|
@ -7118,8 +7117,7 @@ virshParseCPUList(vshControl *ctl, int *cpumaplen,
|
|||
virBitmapPtr map = NULL;
|
||||
|
||||
if (cpulist[0] == 'r') {
|
||||
if (!(map = virBitmapNew(maxcpu)))
|
||||
return NULL;
|
||||
map = virBitmapNew(maxcpu);
|
||||
virBitmapSetAll(map);
|
||||
} else {
|
||||
int lastcpu;
|
||||
|
@ -11989,8 +11987,7 @@ virshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2)
|
|||
if (n1_child_size == 0 && n2_child_size == 0)
|
||||
return true;
|
||||
|
||||
if (!(bitmap = virBitmapNew(n1_child_size)))
|
||||
return false;
|
||||
bitmap = virBitmapNew(n1_child_size);
|
||||
|
||||
child2 = n2->children;
|
||||
while (child2) {
|
||||
|
|
Loading…
Reference in New Issue