From a071cf575cafc3d8c15e4886fd65b8763086016f Mon Sep 17 00:00:00 2001 From: Burt P Date: Sat, 3 Aug 2019 13:15:12 -0500 Subject: auto_free: update with auto_free_on_exit(), use to free arm_ids_file in arm_data.c Signed-off-by: Burt P --- deps/sysobj_early/include/auto_free.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'deps/sysobj_early/include/auto_free.h') diff --git a/deps/sysobj_early/include/auto_free.h b/deps/sysobj_early/include/auto_free.h index e038783d..bddaa321 100644 --- a/deps/sysobj_early/include/auto_free.h +++ b/deps/sysobj_early/include/auto_free.h @@ -36,20 +36,29 @@ /* the minimum time between auto_free(p) and free(p) */ #define AF_DELAY_SECONDS 10 +#define AF_USE_SYSOBJ 0 + #if (DEBUG_AUTO_FREE > 0) -#define auto_free(p) auto_free_(p, __FILE__, __LINE__, __FUNCTION__) +#define auto_free(p) auto_free_ex_(p, (GDestroyNotify)g_free, __FILE__, __LINE__, __FUNCTION__) #define auto_free_ex(p, f) auto_free_ex_(p, f, __FILE__, __LINE__, __FUNCTION__) +#define auto_free_on_exit(p) auto_free_on_exit_ex_(p, (GDestroyNotify)g_free, __FILE__, __LINE__, __FUNCTION__) +#define auto_free_on_exit_ex(p, f) auto_free_on_exit_ex_(p, f, __FILE__, __LINE__, __FUNCTION__) #else -#define auto_free(p) auto_free_(p, NULL, 0, NULL) +#define auto_free(p) auto_free_ex_(p, (GDestroyNotify)g_free, NULL, 0, NULL) #define auto_free_ex(p, f) auto_free_ex_(p, f, NULL, 0, NULL) +#define auto_free_on_exit(p) auto_free_on_exit_ex_(p, (GDestroyNotify)g_free, NULL, 0, NULL) +#define auto_free_on_exit_ex(p, f) auto_free_on_exit_ex_(p, f, NULL, 0, NULL) #endif -gpointer auto_free_(gpointer p, const char *file, int line, const char *func); gpointer auto_free_ex_(gpointer p, GDestroyNotify f, const char *file, int line, const char *func); +gpointer auto_free_on_exit_ex_(gpointer p, GDestroyNotify f, const char *file, int line, const char *func); -/* free all the auto_free marked items in the current thread */ +/* free all the auto_free marked items in the + * current thread with age > AF_DELAY_SECONDS */ void free_auto_free(); -/* call at thread termination */ +/* call at thread termination: + * free all the auto_free marked items in the + * current thread regardless of age */ void free_auto_free_thread_final(); /* call at program termination */ -- cgit v1.2.3