[PATCH 2/3] util: json: Remove virJSONValueGetArrayAsBitmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function is not used.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/libvirt_private.syms |  1 -
 src/util/virjson.c       | 51 ----------------------------------------
 src/util/virjson.h       |  2 --
 3 files changed, 54 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f36400b5f6..0801728a74 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2478,7 +2478,6 @@ virJSONValueArraySteal;
 virJSONValueCopy;
 virJSONValueFree;
 virJSONValueFromString;
-virJSONValueGetArrayAsBitmap;
 virJSONValueGetBoolean;
 virJSONValueGetNumberDouble;
 virJSONValueGetNumberInt;
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 82081db870..746386c619 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1174,57 +1174,6 @@ virJSONValueGetBoolean(virJSONValuePtr val,
 }


-/**
- * virJSONValueGetArrayAsBitmap:
- * @val: JSON array to convert to bitmap
- * @bitmap: New bitmap is allocated filled and returned via this argument
- *
- * Attempts a conversion of a JSON array to a bitmap. The members of the array
- * must be non-negative integers for the conversion to succeed. This function
- * does not report libvirt errors so that it can be used to probe that the
- * array can be represented as a bitmap.
- *
- * Returns 0 on success and fills @bitmap; -1 on error and  @bitmap is set to
- * NULL.
- */
-int
-virJSONValueGetArrayAsBitmap(const virJSONValue *val,
-                             virBitmapPtr *bitmap)
-{
-    virJSONValuePtr elem;
-    size_t i;
-    g_autofree unsigned long long *elems = NULL;
-    unsigned long long maxelem = 0;
-
-    *bitmap = NULL;
-
-    if (val->type != VIR_JSON_TYPE_ARRAY)
-        return -1;
-
-    elems = g_new0(unsigned long long, val->data.array.nvalues);
-
-    /* first pass converts array members to numbers and finds the maximum */
-    for (i = 0; i < val->data.array.nvalues; i++) {
-        elem = val->data.array.values[i];
-
-        if (elem->type != VIR_JSON_TYPE_NUMBER ||
-            virStrToLong_ullp(elem->data.number, NULL, 10, &elems[i]) < 0)
-            return -1;
-
-        if (elems[i] > maxelem)
-            maxelem = elems[i];
-    }
-
-    *bitmap = virBitmapNew(maxelem + 1);
-
-    /* second pass sets the correct bits in the map */
-    for (i = 0; i < val->data.array.nvalues; i++)
-        ignore_value(virBitmapSetBit(*bitmap, elems[i]));
-
-    return 0;
-}
-
-
 virJSONValuePtr
 virJSONValueNewArrayFromBitmap(virBitmapPtr bitmap)
 {
diff --git a/src/util/virjson.h b/src/util/virjson.h
index c22bc1fb45..1f15b23233 100644
--- a/src/util/virjson.h
+++ b/src/util/virjson.h
@@ -107,8 +107,6 @@ int virJSONValueGetNumberLong(virJSONValuePtr object, long long *value);
 int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long *value);
 int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value);
 int virJSONValueGetBoolean(virJSONValuePtr object, bool *value);
-int virJSONValueGetArrayAsBitmap(const virJSONValue *val, virBitmapPtr *bitmap)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 bool virJSONValueIsNull(virJSONValuePtr object);
 virJSONValuePtr virJSONValueObjectGetObject(virJSONValuePtr object,
                                             const char *key);
-- 
2.30.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux