render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From 2fe1b73a5dbbfd79c3a1a8c48747a68846785e3b Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <2fe1b73a5dbbfd79c3a1a8c48747a68846785e3b@dist-git>
c480ed
From: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
c480ed
Date: Wed, 5 Jun 2019 11:33:27 +0200
c480ed
Subject: [PATCH] util: bitmap: define cleanup function using
c480ed
 VIR_DEFINE_AUTOPTR_FUNC
c480ed
c480ed
Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
c480ed
src/util/viralloc.h, define a new wrapper around an existing
c480ed
cleanup function which will be called when a variable declared
c480ed
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
c480ed
viralloc.h include, since that has moved from the source module into the
c480ed
header.
c480ed
c480ed
When a variable of type virBitmapPtr is declared using
c480ed
VIR_AUTOPTR, the function virBitmapFree will be run
c480ed
automatically on it when it goes out of scope.
c480ed
c480ed
Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
c480ed
Reviewed-by: Erik Skultety <eskultet@redhat.com>
c480ed
(cherry picked from commit a3c915e662f8c25cac683e20bbc419b497555e13)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1716943
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Message-Id: <fcbb5d4453100962a2fc83e486da799012eec675.1559727075.git.mprivozn@redhat.com>
c480ed
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
c480ed
---
c480ed
 src/util/virbitmap.c | 1 -
c480ed
 src/util/virbitmap.h | 3 +++
c480ed
 2 files changed, 3 insertions(+), 1 deletion(-)
c480ed
c480ed
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
c480ed
index 0cc5292d8c..ef18dad255 100644
c480ed
--- a/src/util/virbitmap.c
c480ed
+++ b/src/util/virbitmap.c
c480ed
@@ -31,7 +31,6 @@
c480ed
 #include <sys/types.h>
c480ed
 
c480ed
 #include "virbitmap.h"
c480ed
-#include "viralloc.h"
c480ed
 #include "virbuffer.h"
c480ed
 #include "c-ctype.h"
c480ed
 #include "count-one-bits.h"
c480ed
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
c480ed
index 2464814055..312e7e2933 100644
c480ed
--- a/src/util/virbitmap.h
c480ed
+++ b/src/util/virbitmap.h
c480ed
@@ -25,6 +25,7 @@
c480ed
 # define __BITMAP_H__
c480ed
 
c480ed
 # include "internal.h"
c480ed
+# include "viralloc.h"
c480ed
 
c480ed
 # include <sys/types.h>
c480ed
 
c480ed
@@ -155,4 +156,6 @@ void virBitmapSubtract(virBitmapPtr a, virBitmapPtr b)
c480ed
 
c480ed
 void virBitmapShrink(virBitmapPtr map, size_t b);
c480ed
 
c480ed
+VIR_DEFINE_AUTOPTR_FUNC(virBitmap, virBitmapFree)
c480ed
+
c480ed
 #endif
c480ed
-- 
c480ed
2.22.0
c480ed