diff options
author | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2012-10-09 17:55:34 +0000 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2012-10-09 17:55:34 +0000 |
commit | 6368cfbbc2fb4c4906177106645a09e1887e0534 (patch) | |
tree | 2e40009f11593de517d1bec81601f5388b03f831 /legacy/efreet | |
parent | 4cd60a96e1a0e02657a098ec51e603f8f16cfe21 (diff) |
cleanup macros.
eina_stringshare_replace() does a nice job.
EINA_LIST_FREE() always exit with empty (NULL) list.
SVN revision: 77667
Diffstat (limited to 'legacy/efreet')
-rw-r--r-- | legacy/efreet/src/lib/efreet_private.h | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h index ac43c4a3a5..8705e3b49f 100644 --- a/legacy/efreet/src/lib/efreet_private.h +++ b/legacy/efreet/src/lib/efreet_private.h | |||
@@ -39,23 +39,20 @@ | |||
39 | * @def IF_RELEASE(x) | 39 | * @def IF_RELEASE(x) |
40 | * If x is set, eina_stringshare_del x and set to NULL | 40 | * If x is set, eina_stringshare_del x and set to NULL |
41 | */ | 41 | */ |
42 | #define IF_RELEASE(x) do { \ | 42 | #define IF_RELEASE(x) eina_stringshare_replace(&(x), NULL) |
43 | if (x) { \ | ||
44 | const char *__tmp; __tmp = (x); (x) = NULL; eina_stringshare_del(__tmp); \ | ||
45 | } \ | ||
46 | (x) = NULL; \ | ||
47 | } while (0) | ||
48 | 43 | ||
49 | /** | 44 | /** |
50 | * @def IF_FREE_LIST(x) | 45 | * @def IF_FREE_LIST(x) |
51 | * If x is a valid pointer destroy x and set to NULL | 46 | * If x is a valid pointer destroy x and set to NULL |
52 | */ | 47 | */ |
53 | #define IF_FREE_LIST(list, free_cb) do { \ | 48 | #define IF_FREE_LIST(list, free_cb) \ |
54 | void *_data; \ | 49 | do \ |
55 | EINA_LIST_FREE(list, _data) \ | 50 | { \ |
56 | free_cb(_data); \ | 51 | void *_data; \ |
57 | list = NULL; \ | 52 | EINA_LIST_FREE(list, _data) \ |
58 | } while (0) | 53 | free_cb(_data); \ |
54 | } \ | ||
55 | while (0) | ||
59 | 56 | ||
60 | /** | 57 | /** |
61 | * @def IF_FREE_HASH(x) | 58 | * @def IF_FREE_HASH(x) |