From 5cd017d563d201f1b46f9825eba846589ee170aa Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 3 Apr 2019 13:37:26 +0200 Subject: [PATCH] util: Move VIR_AUTOUNREF definition to virobject.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- 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..d13fc4b1ac 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -113,6 +113,16 @@ virObjectUnref(void *obj); void virObjectAutoUnref(void *objptr); +/** + * 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 * virObjectRef(void *obj);