Commit 3a81c0f3 authored by Thomas Haller's avatar Thomas Haller

macros: add nm_auto() macro to cleanup functions

parent bf29d02a
......@@ -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)
/********************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment