* src/filtering.[ch]
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 10 Jun 2003 17:02:05 +0000 (17:02 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Tue, 10 Jun 2003 17:02:05 +0000 (17:02 +0000)
* src/folder.c
* src/matcher.c
* src/scoring.[ch]
- try fixing bug #18 (any brave testers?)
- add more robustness by refusing previously
  unchecked NULL pointers

ChangeLog.claws
configure.ac
src/filtering.c
src/filtering.h
src/folder.c
src/matcher.c
src/scoring.c
src/scoring.h

index a7347ca..283d27b 100644 (file)
@@ -1,3 +1,13 @@
+2003-06-10 [alfons]    0.9.0claws27
+
+       * src/filtering.[ch]
+       * src/folder.c
+       * src/matcher.c
+       * src/scoring.[ch]
+               - try fixing bug #18 (any brave testers?)
+               - add more robustness by refusing previously 
+                 unchecked NULL pointers 
+
 2003-06-10 [alfons]    0.9.0claws26
 
        * src/procmsg.c
index d783c39..b742e38 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws26
+EXTRA_VERSION=claws27
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 6b9b139..7a97d0c 100644 (file)
@@ -129,6 +129,7 @@ FilteringProp * filteringprop_copy(FilteringProp *src)
 
 void filteringprop_free(FilteringProp * prop)
 {
+       g_return_if_fail(prop);
        matcherlist_free(prop->matchers);
        filteringaction_free(prop->action);
        g_free(prop);
@@ -429,8 +430,8 @@ static gboolean prefs_filtering_free_func(GNode *node, gpointer data)
 {
        FolderItem *item = node->data;
 
-       if(!item->prefs)
-               return FALSE;
+       g_return_val_if_fail(item, FALSE);
+       g_return_val_if_fail(item->prefs, FALSE);
 
        prefs_filtering_free(item->prefs->processing);
        item->prefs->processing = NULL;
@@ -453,3 +454,14 @@ void prefs_filtering_clear(void)
        prefs_filtering_free(global_processing);
        global_processing = NULL;
 }
+
+void prefs_filtering_clear_folder(Folder *folder)
+{
+       g_return_if_fail(folder);
+       g_return_if_fail(folder->node);
+
+       g_node_traverse(folder->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+                       prefs_filtering_free_func, NULL);
+       /* FIXME: Note folder settings were changed, where the updates? */
+}
+
index 255fa16..0b8f5e6 100644 (file)
@@ -66,6 +66,7 @@ void prefs_filtering_read_config(void);
 gchar * filteringprop_to_string(FilteringProp *prop);
 
 void prefs_filtering_clear(void);
+void prefs_filtering_clear_folder(Folder *folder);
 void prefs_filtering_free(GSList *prefs_filtering);
 
 FilteringProp * filteringprop_copy(FilteringProp *src);
index 701156d..ecdbcb6 100644 (file)
@@ -302,8 +302,8 @@ void folder_tree_destroy(Folder *folder)
        g_return_if_fail(folder != NULL);
        g_return_if_fail(folder->node != NULL);
        
-       prefs_scoring_clear();
-       prefs_filtering_clear();
+       prefs_scoring_clear_folder(folder);
+       prefs_filtering_clear_folder(folder);
 
        g_node_traverse(folder->node, G_POST_ORDER, G_TRAVERSE_ALL, -1, folder_tree_destroy_func, NULL);
        if (folder->node)
index 22af840..f47abd5 100644 (file)
@@ -615,6 +615,7 @@ void matcherlist_free(MatcherList *cond)
 {
        GSList *l;
 
+       g_return_if_fail(cond);
        for (l = cond->matchers ; l != NULL ; l = g_slist_next(l)) {
                matcherprop_free((MatcherProp *) l->data);
        }
index 9bb6034..4252798 100644 (file)
@@ -46,6 +46,7 @@ ScoringProp * scoringprop_copy(ScoringProp *src)
 
 void scoringprop_free(ScoringProp * prop)
 {
+       g_return_if_fail(prop);
        matcherlist_free(prop->matchers);
        g_free(prop);
 }
@@ -146,3 +147,14 @@ void prefs_scoring_clear(void)
        prefs_scoring_free(global_scoring);
        global_scoring = NULL;
 }
+
+/*!
+ *\brief       Clear up scoring for folder
+ */
+void prefs_scoring_clear_folder(Folder *folder)
+{
+       g_return_if_fail(folder);
+       g_return_if_fail(folder->node);
+       g_node_traverse(folder->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+                       prefs_scoring_free_func, NULL);
+}
index 86b0fbc..9bf88e3 100644 (file)
@@ -34,6 +34,8 @@ void prefs_scoring_read_config(void);
 gchar * scoringprop_to_string(ScoringProp * prop);
 
 void prefs_scoring_clear(void);
+void prefs_scoring_clear_folder(Folder *folder);
+
 void prefs_scoring_free(GSList * prefs_scoring);
 
 #endif