[libvirt PATCH 1/7] util: alloc: Remove VIR_ALLOC_QUIET

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/rpc/virnetmessage.c |  2 +-
 src/util/viralloc.h     | 14 --------------
 src/util/virbitmap.c    |  2 +-
 src/util/virerror.c     |  6 +++---
 src/util/virlog.c       |  2 +-
 src/util/virthread.c    |  2 +-
 tests/virpcimock.c      |  6 +++---
 7 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c
index c4ddafc01d..011b32b100 100644
--- a/src/rpc/virnetmessage.c
+++ b/src/rpc/virnetmessage.c
@@ -539,7 +539,7 @@ void virNetMessageSaveError(virNetMessageErrorPtr rerr)
     } else {
         rerr->code = VIR_ERR_INTERNAL_ERROR;
         rerr->domain = VIR_FROM_RPC;
-        if (VIR_ALLOC_QUIET(rerr->message) == 0)
+        if (VIR_ALLOC(rerr->message) == 0)
             *rerr->message = g_strdup(_("Library function returned error but did not set virError"));
         rerr->level = VIR_ERR_ERROR;
     }
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 833f85f62e..ae967f2556 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -75,20 +75,6 @@ void virDisposeString(char **strptr)
  */
 #define VIR_ALLOC(ptr) virAlloc(&(ptr), sizeof(*(ptr)))
 
-/**
- * VIR_ALLOC_QUIET:
- * @ptr: pointer to hold address of allocated memory
- *
- * Allocate sizeof(*ptr) bytes of memory 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_QUIET(ptr) VIR_ALLOC(ptr)
-
 /**
  * VIR_ALLOC_N:
  * @ptr: pointer to hold address of allocated memory
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 60fd8491dd..7198bfa66e 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -69,7 +69,7 @@ virBitmapNewQuiet(size_t size)
 
     sz = VIR_DIV_UP(size, VIR_BITMAP_BITS_PER_UNIT);
 
-    if (VIR_ALLOC_QUIET(bitmap) < 0)
+    if (VIR_ALLOC(bitmap) < 0)
         return NULL;
 
     if (VIR_ALLOC_N_QUIET(bitmap->map, sz) < 0) {
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 507a29f50f..fc9e10c649 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -225,7 +225,7 @@ virErrorCopyNew(virErrorPtr err)
 {
     virErrorPtr ret;
 
-    if (VIR_ALLOC_QUIET(ret) < 0)
+    if (VIR_ALLOC(ret) < 0)
         return NULL;
 
     if (virCopyError(err, ret) < 0)
@@ -241,7 +241,7 @@ virLastErrorObject(void)
     virErrorPtr err;
     err = virThreadLocalGet(&virLastErr);
     if (!err) {
-        if (VIR_ALLOC_QUIET(err) < 0)
+        if (VIR_ALLOC(err) < 0)
             return NULL;
         if (virThreadLocalSet(&virLastErr, err) < 0)
             VIR_FREE(err);
@@ -404,7 +404,7 @@ virSaveLastError(void)
     virErrorPtr to;
     int saved_errno = errno;
 
-    if (VIR_ALLOC_QUIET(to) < 0)
+    if (VIR_ALLOC(to) < 0)
         return NULL;
 
     virCopyLastError(to);
diff --git a/src/util/virlog.c b/src/util/virlog.c
index f6d0c6c050..b368ce23f3 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1327,7 +1327,7 @@ virLogFilterNew(const char *match,
     memcpy(mdup + 1, match, mlen);
     mdup[mlen + 1] = '*';
 
-    if (VIR_ALLOC_QUIET(ret) < 0) {
+    if (VIR_ALLOC(ret) < 0) {
         VIR_FREE(mdup);
         return NULL;
     }
diff --git a/src/util/virthread.c b/src/util/virthread.c
index 7f23399835..c35b918c17 100644
--- a/src/util/virthread.c
+++ b/src/util/virthread.c
@@ -253,7 +253,7 @@ int virThreadCreateFull(virThreadPtr thread,
 
     if ((err = pthread_attr_init(&attr)) != 0)
         goto cleanup;
-    if (VIR_ALLOC_QUIET(args) < 0) {
+    if (VIR_ALLOC(args) < 0) {
         err = ENOMEM;
         goto cleanup;
     }
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 92b6f810d8..76818d0031 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -427,7 +427,7 @@ pci_device_create_iommu(const struct pciDevice *dev,
             return;
     }
 
-    if (VIR_ALLOC_QUIET(iommuGroup) < 0)
+    if (VIR_ALLOC(iommuGroup) < 0)
         ABORT_OOM();
 
     iommuGroup->iommu = dev->iommuGroup;
@@ -469,7 +469,7 @@ pci_device_new_from_stub(const struct pciDevice *data)
         c = strchr(c, ':');
     }
 
-    if (VIR_ALLOC_QUIET(dev) < 0)
+    if (VIR_ALLOC(dev) < 0)
         ABORT_OOM();
 
     configSrc = g_strdup_printf("%s/virpcitestdata/%s.config", abs_srcdir, id);
@@ -694,7 +694,7 @@ pci_driver_new(const char *name, ...)
     int vendor, device;
     g_autofree char *driverpath = NULL;
 
-    if (VIR_ALLOC_QUIET(driver) < 0)
+    if (VIR_ALLOC(driver) < 0)
         ABORT_OOM();
     driver->name = g_strdup(name);
     if (!(driverpath = pci_driver_get_path(driver, NULL, true)))
-- 
2.26.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