[libvirt] [PATCH 1/5] util: Move VIR_AUTOUNREF definition to virobject.h

Peter Krempa pkrempa at redhat.com
Wed Apr 3 13:06:33 UTC 2019


This helper has solely to do with virObjects. Move it together with
other virObject stuff.

This also avoids the potential problem where VIR_AUTOUNREF uses
virObjectAutoUnref which is defined in virobject.h.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/viralloc.h  | 11 -----------
 src/util/virobject.h | 10 ++++++++++
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index a1708b772c..93ec36aae2 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -682,15 +682,4 @@ void virAllocTestHook(void (*func)(int, void*), void *data);
 # define VIR_AUTOCLEAN(type) \
     __attribute__((cleanup(VIR_AUTOCLEAN_FUNC_NAME(type)))) type

-
-/**
- * VIR_AUTOUNREF:
- * @type: type of an virObject subclass to be unref'd automatically
- *
- * Declares a variable of @type which will be automatically unref'd when
- * control goes out of the scope.
- */
-# define VIR_AUTOUNREF(type) \
-    __attribute__((cleanup(virObjectAutoUnref))) type
-
 #endif /* LIBVIRT_VIRALLOC_H */
diff --git a/src/util/virobject.h b/src/util/virobject.h
index 757068fcc1..10ccb491a0 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -110,6 +110,16 @@ virObjectNew(virClassPtr klass)
 bool
 virObjectUnref(void *obj);

+/**
+ * VIR_AUTOUNREF:
+ * @type: type of an virObject subclass to be unref'd automatically
+ *
+ * Declares a variable of @type which will be automatically unref'd when
+ * control goes out of the scope.
+ */
+# define VIR_AUTOUNREF(type) \
+    __attribute__((cleanup(virObjectAutoUnref))) type
+
 void
 virObjectAutoUnref(void *objptr);

-- 
2.20.1




More information about the libvir-list mailing list