diff options
author | Burt P <pburt0@gmail.com> | 2019-08-03 13:15:12 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-08-10 16:47:25 -0700 |
commit | a071cf575cafc3d8c15e4886fd65b8763086016f (patch) | |
tree | e60047d213e2159cdd7980bc2ca3b004e5bbfd14 /deps/sysobj_early/include/auto_free.h | |
parent | 4ebe1d6b2bc615acbe28aa8defdeda2c71d1c57f (diff) |
auto_free: update with auto_free_on_exit(), use to free arm_ids_file in arm_data.c
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'deps/sysobj_early/include/auto_free.h')
-rw-r--r-- | deps/sysobj_early/include/auto_free.h | 19 |
1 files changed, 14 insertions, 5 deletions
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 */ |