}
}
- nodeset = virBitmapFormat(nodes);
- if (!nodeset && VIR_STRDUP(nodeset, "") < 0)
+ if (!(nodeset = virBitmapFormat(nodes)))
goto cleanup;
if (virTypedParameterAssign(param, VIR_DOMAIN_NUMA_NODESET,
case 1: /* fill numa nodeset here */
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
nodeset = virBitmapFormat(persistentDef->numatune.memory.nodemask);
- if (!nodeset && VIR_STRDUP(nodeset, "") < 0)
+ if (!nodeset)
goto cleanup;
} else {
if (virCgroupGetCpusetMems(priv->cgroup, &nodeset) < 0)
*
* See virBitmapParse for the format of @str.
*
+ * If bitmap is NULL or it has no bits set, an empty string is returned.
+ *
* Returns the string on success or NULL otherwise. Caller should call
* VIR_FREE to free the string.
*/
bool first = true;
int start, cur, prev;
- if (!bitmap)
- return NULL;
-
- cur = virBitmapNextSetBit(bitmap, -1);
- if (cur < 0) {
+ if (!bitmap || (cur = virBitmapNextSetBit(bitmap, -1)) < 0) {
char *ret;
ignore_value(VIR_STRDUP(ret, ""));
return ret;
char *virBitmapString(virBitmapPtr bitmap)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-char *virBitmapFormat(virBitmapPtr bitmap)
- ATTRIBUTE_NONNULL(1);
+char *virBitmapFormat(virBitmapPtr bitmap);
int virBitmapParse(const char *str,
char sep,