Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_callback.c ewl_config.c ewl_dnd.c ewl_embed.c 
        ewl_engines.c ewl_filelist.c ewl_filelist_column.c 
        ewl_filepicker.c ewl_icon_theme.c ewl_io_manager.c 
        ewl_macros.h ewl_misc.c ewl_mvc.c ewl_radiobutton.c ewl_text.c 
        ewl_theme.c ewl_tree.c ewl_tree2.c ewl_widget.c 


Log Message:
- use macros to free and cleanup lists and hashes

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_callback.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_callback.c      6 Feb 2007 13:42:16 -0000       1.27
+++ ewl_callback.c      5 Mar 2007 11:52:54 -0000       1.28
@@ -75,8 +75,7 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       if (cb_registration)
-               ecore_hash_destroy(cb_registration);
+       IF_FREE_HASH(cb_registration);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_config.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_config.c        12 Feb 2007 13:16:05 -0000      1.26
+++ ewl_config.c        5 Mar 2007 11:52:54 -0000       1.27
@@ -134,14 +134,9 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("cfg", cfg);
        
-       if (cfg->data.user) ecore_hash_destroy(cfg->data.user);
-       cfg->data.user = NULL;
-
-       if (cfg->data.system) ecore_hash_destroy(cfg->data.system);
-       cfg->data.system = NULL;
-
-       if (cfg->data.instance) ecore_hash_destroy(cfg->data.instance);
-       cfg->data.instance = NULL;
+       IF_FREE_HASH(cfg->data.user);
+       IF_FREE_HASH(cfg->data.system);
+       IF_FREE_HASH(cfg->data.instance);
 
        IF_FREE(cfg->app_name);
        FREE(cfg);
@@ -420,7 +415,7 @@
                ecore_hash_set(hash, key, 
                                ecore_hash_get(cfg->data.system, key)); 
        }
-       ecore_list_destroy(keys);
+       IF_FREE_LIST(keys);
 
        /* set the user data over top */
        keys = ecore_hash_keys(cfg->data.user);
@@ -430,13 +425,13 @@
                ecore_hash_set(hash, key,
                                ecore_hash_get(cfg->data.user, key));
        }
-       ecore_list_destroy(keys);
+       IF_FREE_LIST(keys);
 
        fname = ewl_config_file_name_system_get(cfg);
        ret = ewl_config_save(cfg, hash, fname);
        FREE(fname);
 
-       ecore_hash_destroy(hash);
+       IF_FREE_HASH(hash);
 
        DRETURN_INT(ret, DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_dnd.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- ewl_dnd.c   6 Feb 2007 13:42:17 -0000       1.41
+++ ewl_dnd.c   5 Mar 2007 11:52:54 -0000       1.42
@@ -86,11 +86,9 @@
         * Error handlers.
         */
 accepted_error:
-       ecore_hash_destroy(ewl_dnd_provided_hash);
-       ewl_dnd_provided_hash= NULL;
+       IF_FREE_HASH(ewl_dnd_provided_hash);
 provided_error:
-       ecore_hash_destroy(ewl_dnd_position_hash);
-       ewl_dnd_position_hash = NULL;
+       IF_FREE_HASH(ewl_dnd_position_hash);
 position_error:
        DRETURN_INT(FALSE, DLEVEL_STABLE);
 }
@@ -105,9 +103,9 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       ecore_hash_destroy(ewl_dnd_position_hash);
-       ecore_hash_destroy(ewl_dnd_provided_hash);
-       ecore_hash_destroy(ewl_dnd_accepted_hash);
+       IF_FREE_HASH(ewl_dnd_position_hash);
+       IF_FREE_HASH(ewl_dnd_provided_hash);
+       IF_FREE_HASH(ewl_dnd_accepted_hash);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -605,7 +603,7 @@
                        EWL_EMBED(val)->dnd_last_position = NULL;
                        ecore_hash_remove(ewl_dnd_position_hash, val);
                }
-               ecore_list_destroy(pos);
+               IF_FREE_LIST(pos);
 
                ewl_dragging_current = 0;
                ewl_widget_dnd_reset();
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_embed.c,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -3 -r1.113 -r1.114
--- ewl_embed.c 3 Mar 2007 01:58:19 -0000       1.113
+++ ewl_embed.c 5 Mar 2007 11:52:54 -0000       1.114
@@ -2064,14 +2064,13 @@
                        obj_list = ecore_hash_remove(emb->obj_cache, key);
                        while ((obj = ecore_list_remove_first(obj_list)))
                                ewl_canvas_object_destroy(obj);
-                       ecore_list_destroy(obj_list);
+                       IF_FREE_LIST(obj_list);
                }
 
-               ecore_list_destroy(key_list);
+               IF_FREE_LIST(key_list);
        }
 
-       ecore_hash_destroy(emb->obj_cache);
-       emb->obj_cache = NULL;
+       IF_FREE_HASH(emb->obj_cache);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_engines.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ewl_engines.c       3 Mar 2007 00:53:38 -0000       1.39
+++ ewl_engines.c       5 Mar 2007 11:52:54 -0000       1.40
@@ -51,7 +51,7 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       ecore_hash_destroy(ewl_engines);
+       IF_FREE_HASH(ewl_engines);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -98,7 +98,7 @@
                        }
                }
        }
-       ecore_list_destroy(files);
+       IF_FREE_LIST(files);
 
        DRETURN_PTR(names, DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_filelist.c      3 Mar 2007 02:26:45 -0000       1.26
+++ ewl_filelist.c      5 Mar 2007 11:52:54 -0000       1.27
@@ -767,9 +767,9 @@
                FREE(file);
        }
 
-       ecore_list_destroy(all_files);
-       ecore_list_destroy(files);
-       ecore_list_destroy(dirs);
+       IF_FREE_LIST(all_files);
+       IF_FREE_LIST(files);
+       IF_FREE_LIST(dirs);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -1049,7 +1049,7 @@
 
        fl = EWL_FILELIST(w);
 
-       if (fl->selected) ecore_list_destroy(fl->selected);
+       IF_FREE_LIST(fl->selected);
        IF_FREE(fl->directory);
        IF_FREE(fl->filter);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_column.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_filelist_column.c       4 Mar 2007 00:52:01 -0000       1.26
+++ ewl_filelist_column.c       5 Mar 2007 11:52:54 -0000       1.27
@@ -228,7 +228,7 @@
                                        ewl_filelist_column_row_add, s);
        }
 
-       ecore_list_destroy(path_list);
+       IF_FREE_LIST(path_list);
        FREE(new_path);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filepicker.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ewl_filepicker.c    4 Mar 2007 00:52:01 -0000       1.26
+++ ewl_filepicker.c    5 Mar 2007 11:52:54 -0000       1.27
@@ -823,8 +823,8 @@
                FREE(filter);
        }
 
-       ecore_list_destroy(fp->path);
-       ecore_list_destroy(fp->filters);
+       IF_FREE_LIST(fp->path);
+       IF_FREE_LIST(fp->filters);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_icon_theme.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- ewl_icon_theme.c    6 Feb 2007 13:42:17 -0000       1.16
+++ ewl_icon_theme.c    5 Mar 2007 11:52:54 -0000       1.17
@@ -49,8 +49,7 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       if (ewl_icon_theme_cache) ecore_hash_destroy(ewl_icon_theme_cache);
-       ewl_icon_theme_cache = NULL;
+       IF_FREE_HASH(ewl_icon_theme_cache);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -77,8 +76,7 @@
                ewl_icon_theme_is_edje = 0;
 
        /* destroy the cache and re-create it */
-       if (ewl_icon_theme_cache)
-               ecore_hash_destroy(ewl_icon_theme_cache);
+       IF_FREE_HASH(ewl_icon_theme_cache);
 
        ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, 
ecore_str_compare);
        ecore_hash_set_free_key(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_io_manager.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_io_manager.c    6 Feb 2007 13:42:17 -0000       1.9
+++ ewl_io_manager.c    5 Mar 2007 11:52:54 -0000       1.10
@@ -83,17 +83,8 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       if (ewl_io_manager_ext_icon_map)
-       {
-               ecore_hash_destroy(ewl_io_manager_ext_icon_map);
-               ewl_io_manager_ext_icon_map = NULL;
-       }       
-
-       if (ewl_io_manager_plugins)
-       {
-               ecore_hash_destroy(ewl_io_manager_plugins);
-               ewl_io_manager_plugins = NULL;
-       }
+       IF_FREE_HASH(ewl_io_manager_ext_icon_map);
+       IF_FREE_HASH(ewl_io_manager_plugins);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_macros.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- ewl_macros.h        4 Jan 2007 05:09:47 -0000       1.10
+++ ewl_macros.h        5 Mar 2007 11:52:54 -0000       1.11
@@ -64,6 +64,19 @@
        } \
 }
 
+#undef IF_FREE_HASH
+/**
+ * @def IF_FREE_HASH(list)
+ * If @a hash is non-NULL, free @a hash and set it NULL.
+ */
+#define IF_FREE_HASH(hash) \
+{ \
+       if (hash) { \
+               ecore_hash_destroy(hash); \
+               hash = NULL; \
+       } \
+}
+
 #undef ZERO
 /**
  * @def ZERO(ptr, type, num)
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_misc.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -3 -r1.85 -r1.86
--- ewl_misc.c  5 Mar 2007 11:22:58 -0000       1.85
+++ ewl_misc.c  5 Mar 2007 11:52:54 -0000       1.86
@@ -620,7 +620,7 @@
                else
                        i++;
        }
-       ecore_list_destroy(engines);
+       IF_FREE_LIST(engines);
 
        DRETURN(DLEVEL_STABLE);
 }
@@ -674,7 +674,7 @@
                printf("\t--ewl-%s\n", name);
                FREE(name);
        }
-       ecore_list_destroy(names);
+       IF_FREE_LIST(names);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_mvc.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_mvc.c   2 Mar 2007 02:33:10 -0000       1.19
+++ ewl_mvc.c   5 Mar 2007 11:52:54 -0000       1.20
@@ -240,9 +240,7 @@
        mvc->selection_mode = mode;
        if (mode == EWL_SELECTION_MODE_NONE)
        {
-               if (mvc->selected)
-                       ecore_list_destroy(mvc->selected);
-               mvc->selected = NULL;
+               IF_FREE_LIST(mvc->selected);
        }
        else if (!mvc->selected)
        {
@@ -955,8 +953,7 @@
        DCHECK_PARAM_PTR("w", w);
 
        mvc = EWL_MVC(w);
-       if (mvc->selected)
-               ecore_list_destroy(mvc->selected);
+       IF_FREE_LIST(mvc->selected);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -1172,7 +1169,7 @@
                        while ((w = ecore_list_remove_first(sel->highlight)))
                                ewl_widget_destroy(w);
 
-                       ecore_list_destroy(sel->highlight);
+                       IF_FREE_LIST(sel->highlight);
                }
                sel->highlight = NULL;
        }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_radiobutton.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_radiobutton.c   6 Feb 2007 13:42:17 -0000       1.14
+++ ewl_radiobutton.c   5 Mar 2007 11:52:54 -0000       1.15
@@ -165,10 +165,8 @@
        ecore_list_goto(rb->chain, w);
        ecore_list_remove(rb->chain);
 
-       if (ecore_list_is_empty(rb->chain)) {
-               ecore_list_destroy(rb->chain);
-               rb->chain = NULL;
-       }
+       if (ecore_list_is_empty(rb->chain))
+               IF_FREE_LIST(rb->chain);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -3 -r1.159 -r1.160
--- ewl_text.c  4 Mar 2007 00:52:01 -0000       1.159
+++ ewl_text.c  5 Mar 2007 11:52:54 -0000       1.160
@@ -3771,11 +3771,7 @@
        /* Note, we don't explictly destroy the triggers or the selection
         * because they will be cleared as children of the text widget
         * itself */
-       if (t->triggers)
-       {
-               ecore_list_destroy(t->triggers);
-               t->triggers = NULL;
-       }
+       IF_FREE_LIST(t->triggers);
        t->selection = NULL;
 
        ecore_dlist_destroy(t->formatting.nodes);
@@ -4391,7 +4387,7 @@
                while ((area = ecore_list_remove_first(t->areas)))
                        ewl_widget_destroy(EWL_WIDGET(area));
 
-               ecore_list_destroy(t->areas);
+               IF_FREE_LIST(t->areas);
        }
 
        /* remove ourself from the parents trigger list, if needed */
@@ -5232,10 +5228,7 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       if (context_hash) {
-               ecore_hash_destroy(context_hash);
-               context_hash = NULL;
-       }
+       IF_FREE_HASH(context_hash);
 
        if (ewl_text_default_context)
        {
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_theme.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- ewl_theme.c 28 Feb 2007 12:24:46 -0000      1.39
+++ ewl_theme.c 5 Mar 2007 11:52:55 -0000       1.40
@@ -49,10 +49,7 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
 
        IF_FREE_LIST(ewl_theme_font_paths);
-       if (ewl_theme_def_data) {
-               ecore_hash_destroy(ewl_theme_def_data);
-               ewl_theme_def_data = NULL;
-       }
+       IF_FREE_HASH(ewl_theme_def_data);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -73,7 +70,7 @@
        DCHECK_PARAM_PTR_RET("theme_name", theme_name, FALSE);
 
        /* Allocate and clear the default theme */
-       if (ewl_theme_def_data) ecore_hash_destroy(ewl_theme_def_data);
+       IF_FREE_HASH(ewl_theme_def_data);
 
        ewl_theme_def_data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        if (!ewl_theme_def_data)
@@ -150,7 +147,7 @@
         * We destroy ewl_theme_def_data from else where.. 
         */
        if (w->theme && w->theme != ewl_theme_def_data)
-               ecore_hash_destroy(w->theme);
+               IF_FREE_HASH(w->theme);
 
        w->theme = NULL;
 
@@ -308,10 +305,7 @@
        DCHECK_PARAM_PTR("w", w);
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
-       if (w->theme) {
-               ecore_hash_destroy(w->theme);
-               w->theme = NULL;
-       }
+       IF_FREE_HASH(w->theme);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- ewl_tree.c  3 Mar 2007 01:58:19 -0000       1.46
+++ ewl_tree.c  5 Mar 2007 11:52:55 -0000       1.47
@@ -817,7 +817,7 @@
        DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
 
        tree = EWL_TREE(w);
-       ecore_list_destroy(tree->selected);
+       IF_FREE_LIST(tree->selected);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -1002,7 +1002,7 @@
                ewl_widget_hide(w);
        }
 
-       ecore_list_destroy(tmp);
+       IF_FREE_LIST(tmp);
 
        node->expanded = EWL_TREE_NODE_COLLAPSED;
 
@@ -1055,7 +1055,7 @@
                ewl_widget_show(w);
        }
 
-       ecore_list_destroy(tmp);
+       IF_FREE_LIST(tmp);
 
        ewl_widget_state_set(EWL_WIDGET(node), "expanded",
                                EWL_STATE_PERSISTENT);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- ewl_tree2.c 4 Mar 2007 00:52:01 -0000       1.59
+++ ewl_tree2.c 5 Mar 2007 11:52:55 -0000       1.60
@@ -474,7 +474,7 @@
        if (ecore_list_is_empty(exp))
        {
                ecore_hash_remove(tree->expansions, data);
-               ecore_list_destroy(exp);
+               IF_FREE_LIST(exp);
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -540,8 +540,8 @@
 
        t = EWL_TREE2(w);
 
-       ecore_list_destroy(t->columns);
-       if (t->expansions) ecore_hash_destroy(t->expansions);
+       IF_FREE_LIST(t->columns);
+       IF_FREE_HASH(t->expansions);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
@@ -1331,7 +1331,7 @@
        while ((child = ecore_list_remove_first(tmp)))
                ewl_widget_show(child);
 
-       ecore_list_destroy(tmp);
+       IF_FREE_LIST(tmp);
 
        ewl_tree2_row_expand(EWL_TREE2(node->tree), node->data, node->row_num);
 
@@ -1371,7 +1371,7 @@
        while ((child = ecore_list_remove_first(tmp)))
                ewl_widget_hide(child);
 
-       ecore_list_destroy(tmp);
+       IF_FREE_LIST(tmp);
 
        ewl_tree2_row_collapse(EWL_TREE2(node->tree), node->data, 
node->row_num);
 
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -3 -r1.128 -r1.129
--- ewl_widget.c        3 Mar 2007 01:58:19 -0000       1.128
+++ ewl_widget.c        5 Mar 2007 11:52:55 -0000       1.129
@@ -593,11 +593,10 @@
 
        if (ecore_hash_count(w_data) == 0) {
                ecore_hash_remove(ewl_widget_data_table, w);
-               ecore_hash_destroy(w_data);
-               if (ecore_hash_count(ewl_widget_data_table) == 0) {
-                       ecore_hash_destroy(ewl_widget_data_table);
-                       ewl_widget_data_table = NULL;
-               }
+               IF_FREE_HASH(w_data);
+
+               if (ecore_hash_count(ewl_widget_data_table) == 0)
+                       IF_FREE_HASH(ewl_widget_data_table);
        }
 
        DRETURN_PTR(data, DLEVEL_STABLE);
@@ -2240,10 +2239,7 @@
                Ecore_Hash *w_data;
 
                w_data = ecore_hash_remove(ewl_widget_data_table, w);
-               if (w_data) {
-                       ecore_hash_destroy(w_data);
-                       w_data = NULL;
-               }
+               IF_FREE_HASH(w_data);
        }
        
        FREE(w);
@@ -3401,8 +3397,7 @@
 {
        DENTER_FUNCTION(DLEVEL_STABLE);
 
-       if (ewl_widget_name_table)
-               ecore_hash_destroy(ewl_widget_name_table);
+       IF_FREE_HASH(ewl_widget_name_table);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
 }



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to