From 3a81c0f301aa0966df19ce68ad632ca13d9208dc Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 28 Feb 2016 11:53:54 +0100 Subject: [PATCH] macros: add nm_auto() macro to cleanup functions --- shared/nm-macros-internal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/nm-macros-internal.h b/shared/nm-macros-internal.h index 9971f15c8c..aa38bacf55 100644 --- a/shared/nm-macros-internal.h +++ b/shared/nm-macros-internal.h @@ -24,12 +24,14 @@ /********************************************************/ +#define nm_auto(fcn) __attribute ((cleanup(fcn))) + /** * nm_auto_free: * * Call free() on a variable location when it goes out of scope. */ -#define nm_auto_free __attribute__ ((cleanup(_nm_auto_free_impl))) +#define nm_auto_free nm_auto(_nm_auto_free_impl) GS_DEFINE_CLEANUP_FUNCTION(void*, _nm_auto_free_impl, free) /********************************************************/