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

[libvirt PATCH 2/7] util: alloc: Remove VIR_ALLOC_N_QUIET



Signed-off-by: Tim Wiederhake <twiederh redhat com>
---
 src/util/viralloc.h     | 15 ---------------
 src/util/virbitmap.c    |  2 +-
 src/util/virdevmapper.c |  2 +-
 src/util/virjson.c      |  2 +-
 src/util/virlog.c       |  2 +-
 tests/virconftest.c     |  2 +-
 6 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index ae967f2556..c60148724d 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -90,21 +90,6 @@ void virDisposeString(char **strptr)
  */
 #define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count))
 
-/**
- * VIR_ALLOC_N_QUIET:
- * @ptr: pointer to hold address of allocated memory
- * @count: number of elements to allocate
- *
- * Allocate an array of 'count' elements, each sizeof(*ptr)
- * bytes long and store the address of allocated memory in
- * 'ptr'. Fill the newly allocated memory with zeros.
- *
- * This macro is safe to use on arguments with side effects.
- *
- * Returns 0 on success, aborts on OOM
- */
-#define VIR_ALLOC_N_QUIET(ptr, count) VIR_ALLOC_N(ptr, count)
-
 /**
  * VIR_REALLOC_N:
  * @ptr: pointer to hold address of allocated memory
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 7198bfa66e..35ca914ce2 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -72,7 +72,7 @@ virBitmapNewQuiet(size_t size)
     if (VIR_ALLOC(bitmap) < 0)
         return NULL;
 
-    if (VIR_ALLOC_N_QUIET(bitmap->map, sz) < 0) {
+    if (VIR_ALLOC_N(bitmap->map, sz) < 0) {
         VIR_FREE(bitmap);
         return NULL;
     }
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
index 7c89c2a952..3c45d3b7f5 100644
--- a/src/util/virdevmapper.c
+++ b/src/util/virdevmapper.c
@@ -260,7 +260,7 @@ virDevMapperGetTargetsImpl(int controlFD,
         return -1;
     }
 
-    if (VIR_ALLOC_N_QUIET(devPaths, deps->count + 1) < 0)
+    if (VIR_ALLOC_N(devPaths, deps->count + 1) < 0)
         return -1;
 
     for (i = 0; i < deps->count; i++) {
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 6921eccb60..cdaca20628 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1243,7 +1243,7 @@ virJSONValueGetArrayAsBitmap(const virJSONValue *val,
     if (val->type != VIR_JSON_TYPE_ARRAY)
         return -1;
 
-    if (VIR_ALLOC_N_QUIET(elems, val->data.array.nvalues) < 0)
+    if (VIR_ALLOC_N(elems, val->data.array.nvalues) < 0)
         return -1;
 
     /* first pass converts array members to numbers and finds the maximum */
diff --git a/src/util/virlog.c b/src/util/virlog.c
index b368ce23f3..677ba1dfac 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1320,7 +1320,7 @@ virLogFilterNew(const char *match,
     /* We must treat 'foo' as equiv to '*foo*' for g_pattern_match
      * todo substring matches, so add 2 extra bytes
      */
-    if (VIR_ALLOC_N_QUIET(mdup, mlen + 3) < 0)
+    if (VIR_ALLOC_N(mdup, mlen + 3) < 0)
         return NULL;
 
     mdup[0] = '*';
diff --git a/tests/virconftest.c b/tests/virconftest.c
index ab29b5b712..3ae4d4ecc0 100644
--- a/tests/virconftest.c
+++ b/tests/virconftest.c
@@ -42,7 +42,7 @@ static int testConfRoundTrip(const void *opaque)
     srcfile = g_strdup_printf("%s/virconfdata/%s.conf", abs_srcdir, name);
     dstfile = g_strdup_printf("%s/virconfdata/%s.out", abs_srcdir, name);
 
-    if (VIR_ALLOC_N_QUIET(buffer, len) < 0) {
+    if (VIR_ALLOC_N(buffer, len) < 0) {
         fprintf(stderr, "out of memory\n");
         goto cleanup;
     }
-- 
2.26.2


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