[PATCH v1 21/21] util: bitmap: use VIR_AUTOPTR for aggregate types

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

 



By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOPTR
macro, majority of the calls to *Free functions can be dropped, which in
turn leads to getting rid of most of our cleanup sections.
---
 src/util/virbitmap.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index ef18dad..37e5c0e 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -1202,15 +1202,12 @@ char *
 virBitmapDataFormat(const void *data,
                     int len)
 {
-    virBitmapPtr map = NULL;
-    char *ret = NULL;
+    VIR_AUTOPTR(virBitmapPtr) map = NULL;
 
     if (!(map = virBitmapNewData(data, len)))
         return NULL;
 
-    ret = virBitmapFormat(map);
-    virBitmapFree(map);
-    return ret;
+    return virBitmapFormat(map);
 }
 
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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