From 67ee15f0728f9b7a7b3e161a7032d86c98ff8a02 Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Wed, 15 Aug 2007 05:48:47 +0000 Subject: [PATCH] Add macro to free lists. SVN revision: 31317 --- src/bin/e.h | 16 ++++++++++++++++ src/bin/e_actions.c | 10 +--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/bin/e.h b/src/bin/e.h index e60af94e2..123b5b45b 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -119,6 +119,22 @@ typedef struct _E_Rect E_Rect; #define E_NEW(s, n) (s *)calloc(n, sizeof(s)) #define E_NEW_BIG(s, n) (s *)malloc(n * sizeof(s)) #define E_FREE(p) do { if (p) {free(p); p = NULL;} } while (0) +#define E_FREE_LIST(list, free) \ + do \ + { \ + if (list) \ + { \ + Evas_List *tmp; \ + tmp = list; \ + list = NULL; \ + while (tmp) \ + { \ + free(tmp->data); \ + tmp = evas_list_remove_list(tmp, tmp); \ + } \ + } \ + } \ + while (0) #define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x)) diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index 9387612dd..f53d72694 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -2206,20 +2206,12 @@ e_actions_init(void) EAPI int e_actions_shutdown(void) { - Evas_List *l; - e_action_predef_name_all_del(); action_names = evas_list_free(action_names); evas_hash_free(actions); actions = NULL; - l = action_list; - action_list = NULL; - while (l) - { - e_object_del(E_OBJECT(l->data)); - l = evas_list_remove_list(l, l); - } + E_FREE_LIST(action_list, e_object_del); return 1; }