summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-02-28 11:53:54 +0100
committerThomas Haller <thaller@redhat.com>2016-02-29 14:08:00 +0100
commit3a81c0f301aa0966df19ce68ad632ca13d9208dc (patch)
tree45a7f42e7ca1d340af350e2d96eebd6923411ead
parentbf29d02ac11fb5304bb048bdb2f49b74de7a71dd (diff)
downloadNetworkManager-3a81c0f301aa0966df19ce68ad632ca13d9208dc.tar.gz
macros: add nm_auto() macro to cleanup functions
-rw-r--r--shared/nm-macros-internal.h4
1 files changed, 3 insertions, 1 deletions
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)
/********************************************************/