Using the VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h,
define a new wrapper around an existing cleanup function which will be
called when a variable declared with VIR_AUTOPTR macro goes out of scope.
---
 src/util/virbitmap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 2464814..86bb84e 100644
--- a/src/util/virbitmap.h
+++ b/src/util/virbitmap.h
@@ -25,6 +25,7 @@
 # define __BITMAP_H__
 
 # include "internal.h"
+# include "viralloc.h"
 
 # include <sys/types.h>
 
@@ -44,6 +45,8 @@ virBitmapPtr virBitmapNewEmpty(void) ATTRIBUTE_RETURN_CHECK;
  */
 void virBitmapFree(virBitmapPtr bitmap);
 
+VIR_DEFINE_AUTOPTR_FUNC(virBitmapPtr, virBitmapFree)
+
 /*
  * Copy all bits from @src to @dst. The bitmap sizes
  * must be the same
-- 
1.8.3.1

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

Reply via email to