From: Peter Krempa Date: Wed, 3 Apr 2019 11:37:26 +0000 (+0200) Subject: util: Move VIR_AUTOUNREF definition to virobject.h X-Git-Tag: v5.3.0-rc1~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cd017d563d201f1b46f9825eba846589ee170aa;p=thirdparty%2Flibvirt.git util: Move VIR_AUTOUNREF definition to virobject.h 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 --- 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);