Similar to gs_free to cleanup pointers with free(). Note that
g_free() and free() cannot be used interchangably.
/* always include these headers for our internal source files. */
+#include <stdlib.h>
+
#include "nm-glib.h"
#include "nm-version.h"
#include "gsystem-local-alloc.h"
#ifndef __NM_MACROS_INTERNAL_H__
#define __NM_MACROS_INTERNAL_H__
-#include "nm-default.h"
+/********************************************************/
+
+/**
+ * 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)))
+GS_DEFINE_CLEANUP_FUNCTION(void*, _nm_auto_free_impl, free)
/********************************************************/