]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Do not return number of set bits in virBitmapParse
authorJán Tomko <jtomko@redhat.com>
Fri, 17 Jun 2016 12:11:55 +0000 (14:11 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 20 Jun 2016 10:07:16 +0000 (12:07 +0200)
This is only used by one caller.

src/util/virbitmap.c
src/xen/xend_internal.c

index 4ca59f9d622718de49aff5869cd77dffa13984b2..7e9f3fd199b4891ca17e0311efd3732768fcb0cd 100644 (file)
@@ -419,7 +419,7 @@ char *virBitmapFormat(virBitmapPtr bitmap)
  * Pass 0 as @terminator if it is not needed. Whitespace characters may not
  * be used as terminators.
  *
- * Returns the number of bits set in @bitmap, or -1 in case of error.
+ * Returns 0 on success, or -1 in case of error.
  */
 int
 virBitmapParse(const char *str,
@@ -509,7 +509,7 @@ virBitmapParse(const char *str,
         }
     }
 
-    return virBitmapCountBits(*bitmap);
+    return 0;
 
  error:
     virReportError(VIR_ERR_INVALID_ARG,
index 3e3be58a560ace6394ec2bbaa6a45df953a1095a..21ccff93c3ec6fd345e956abddc8a6e585064a4e 100644 (file)
@@ -1049,9 +1049,10 @@ sexpr_to_xend_topology(const struct sexpr *root, virCapsPtr caps)
             if (!(cpuset = virBitmapNew(numCpus)))
                 goto error;
         } else {
-            nb_cpus = virBitmapParse(cur, 'n', &cpuset, numCpus);
-            if (nb_cpus < 0)
+            if (virBitmapParse(cur, 'n', &cpuset, numCpus) < 0)
                 goto error;
+
+            nb_cpus = virBitmapCountBits(cpuset);
         }
 
         if (VIR_ALLOC_N(cpuInfo, numCpus) < 0) {