[libvirt] [PATCH 1/5] Do not return number of set bits in virBitmapParse

Ján Tomko jtomko at redhat.com
Fri Jun 17 13:33:39 UTC 2016


This is only used by one caller.
---
 src/util/virbitmap.c    | 4 ++--
 src/xen/xend_internal.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 4ca59f9..7e9f3fd 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -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,
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 3e3be58..21ccff9 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -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) {
-- 
2.7.3




More information about the libvir-list mailing list