Index: commands.c
===================================================================
--- commands.c	(revision 73faa26a4aa955d75df73bf1beb16726be045f26)
+++ commands.c	(revision 23fddadbb7a375688e9be9627f1f5ca39aaa54d0)
@@ -2426,5 +2426,5 @@
         f = owl_list_get_element(fl, i);
         owl_list_remove_element(fl, i);
-        owl_filter_free(f);
+        owl_filter_delete(f);
         return;
       } else {
Index: filter.c
===================================================================
--- filter.c	(revision 8bce7509d1604b4a0f8af6f6fb6fa6af7aa8d1d1)
+++ filter.c	(revision 23fddadbb7a375688e9be9627f1f5ca39aaa54d0)
@@ -2,17 +2,23 @@
 #include "owl.h"
 
-int owl_filter_init_fromstring(owl_filter *f, const char *name, const char *string)
-{
+owl_filter *owl_filter_new_fromstring(const char *name, const char *string)
+{
+  owl_filter *f;
   char **argv;
-  int argc, out;
-
-  argv=owl_parseline(string, &argc);
-  out=owl_filter_init(f, name, argc, strs(argv));
+  int argc;
+
+  argv = owl_parseline(string, &argc);
+  f = owl_filter_new(name, argc, strs(argv));
   owl_parsefree(argv, argc);
-  return(out);
-}
-
-int owl_filter_init(owl_filter *f, const char *name, int argc, const char *const *argv)
-{
+
+  return f;
+}
+
+owl_filter *owl_filter_new(const char *name, int argc, const char *const *argv)
+{
+  owl_filter *f;
+
+  f = owl_malloc(sizeof(owl_filter));
+
   f->name=owl_strdup(name);
   f->fgcolor=OWL_COLOR_DEFAULT;
@@ -40,15 +46,17 @@
   }
 
-  if(!(f->root = owl_filter_parse_expression(argc, argv, NULL)))
-    return(-1);
+  if (!(f->root = owl_filter_parse_expression(argc, argv, NULL))) {
+    owl_filter_delete(f);
+    return NULL;
+  }
 
   /* Now check for recursion. */
   if (owl_filter_is_toodeep(f)) {
     owl_function_error("Filter loop!");
-    owl_filter_free(f);
-    return(-1);
-  }
-
-  return(0);
+    owl_filter_delete(f);
+    return NULL;
+  }
+
+  return f;
 }
 
@@ -255,10 +263,14 @@
 }
 
-void owl_filter_free(owl_filter *f)
-{
-  if(f->root) {
+void owl_filter_delete(owl_filter *f)
+{
+  if (f == NULL)
+    return;
+  if (f->root) {
     owl_filterelement_free(f->root);
     owl_free(f->root);
   }
-  if (f->name) owl_free(f->name);
-}
+  if (f->name)
+    owl_free(f->name);
+  owl_free(f);
+}
Index: functions.c
===================================================================
--- functions.c	(revision 52761cc7346cb35d2d70160f25573df691427ef2)
+++ functions.c	(revision 23fddadbb7a375688e9be9627f1f5ca39aaa54d0)
@@ -2133,5 +2133,5 @@
   owl_filter *f;
   const owl_view *v;
-  int ret, inuse=0;
+  int inuse = 0;
 
   if (argc < 2) {
@@ -2183,8 +2183,6 @@
 
   /* create the filter and check for errors */
-  f=owl_malloc(sizeof(owl_filter));
-  ret=owl_filter_init(f, argv[1], argc-2, argv+2);
-  if (ret==-1) {
-    owl_free(f);
+  f = owl_filter_new(argv[1], argc-2, argv+2);
+  if (f == NULL) {
     owl_function_error("Invalid filter");
     return;
@@ -2382,6 +2380,5 @@
   if (tmpinstance) owl_free(tmpinstance);
 
-  f=owl_malloc(sizeof(owl_filter));
-  owl_filter_init_fromstring(f, filtname, argbuff);
+  f = owl_filter_new_fromstring(filtname, argbuff);
 
   /* add it to the global list */
@@ -2421,6 +2418,4 @@
 
   /* create the new-internal filter */
-  f=owl_malloc(sizeof(owl_filter));
-
   esclonguser = owl_text_quote(longuser, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
 
@@ -2430,5 +2425,5 @@
       esclonguser);
 
-  owl_filter_init_fromstring(f, filtname, argbuff);
+  f = owl_filter_new_fromstring(filtname, argbuff);
 
   /* add it to the global list */
@@ -2465,6 +2460,4 @@
 
   /* create the new-internal filter */
-  f=owl_malloc(sizeof(owl_filter));
-
   escuser = owl_text_quote(user, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
 
@@ -2474,5 +2467,5 @@
       escuser, owl_global_get_aim_screenname_for_filters(&g));
 
-  owl_filter_init_fromstring(f, filtname, argbuff);
+  f = owl_filter_new_fromstring(filtname, argbuff);
 
   /* add it to the global list */
@@ -2506,5 +2499,5 @@
   argbuff = owl_sprintf("type ^%s$", esctype);
 
-  owl_filter_init_fromstring(f, filtname, argbuff);
+  f = owl_filter_new_fromstring(filtname, argbuff);
 
   /* add it to the global list */
@@ -2825,16 +2818,12 @@
   owl_filter *f;
   owl_list *fl;
-  int ret, i, j;
+  int i, j;
   fl=owl_global_get_puntlist(&g);
 
   /* first, create the filter */
-  f=owl_malloc(sizeof(owl_filter));
-
   owl_function_debugmsg("About to filter %s", filter);
-  ret=owl_filter_init_fromstring(f, "punt-filter", filter);
-  if (ret) {
+  f = owl_filter_new_fromstring("punt-filter", filter);
+  if (f == NULL) {
     owl_function_error("Error creating filter for zpunt");
-    owl_filter_free(f);
-    owl_free(f);
     return;
   }
@@ -2847,6 +2836,5 @@
       /* if we're punting, then just silently bow out on this duplicate */
       if (direction==0) {
-	owl_filter_free(f);
-	owl_free(f);
+	owl_filter_delete(f);
 	return;
       }
@@ -2854,8 +2842,7 @@
       /* if we're unpunting, then remove this filter from the puntlist */
       if (direction==1) {
-	owl_filter_free(owl_list_get_element(fl, i));
+	owl_filter_delete(owl_list_get_element(fl, i));
 	owl_list_remove_element(fl, i);
-        owl_filter_free(f);
-	owl_free(f);
+	owl_filter_delete(f);
 	return;
       }
Index: global.c
===================================================================
--- global.c	(revision 52761cc7346cb35d2d70160f25573df691427ef2)
+++ global.c	(revision 23fddadbb7a375688e9be9627f1f5ca39aaa54d0)
@@ -635,5 +635,5 @@
     f=owl_list_get_element(&(g->filterlist), i);
     if (!strcmp(name, owl_filter_get_name(f))) {
-      owl_filter_free(f);
+      owl_filter_delete(f);
       owl_list_remove_element(&(g->filterlist), i);
       break;
Index: owl.c
===================================================================
--- owl.c	(revision 84ea53cceca0c0915283fccbb9e6fece4cbcc25f)
+++ owl.c	(revision 23fddadbb7a375688e9be9627f1f5ca39aaa54d0)
@@ -151,5 +151,4 @@
 static void owl_setup_default_filters(void)
 {
-  owl_filter *f;
   int i;
   static const struct {
@@ -176,9 +175,8 @@
   owl_function_debugmsg("startup: creating default filters");
 
-  for (i = 0; filters[i].name != NULL; i++) {
-    f = owl_malloc(sizeof(owl_filter));
-    owl_filter_init_fromstring(f, filters[i].name, filters[i].desc);
-    owl_list_append_element(owl_global_get_filterlist(&g), f);
-  }
+  for (i = 0; filters[i].name != NULL; i++)
+    owl_list_append_element(owl_global_get_filterlist(&g),
+			    owl_filter_new_fromstring(filters[i].name,
+						      filters[i].desc));
 }
 
Index: tester.c
===================================================================
--- tester.c	(revision dd6af024c4bf2c85073470fc34c51442294a0b27)
+++ tester.c	(revision 23fddadbb7a375688e9be9627f1f5ca39aaa54d0)
@@ -194,13 +194,13 @@
 
 int owl_filter_test_string(const char * filt, const owl_message *m, int shouldmatch) /* noproto */ {
-  owl_filter f;
+  owl_filter *f;
   int ok;
   int failed = 0;
-  if(owl_filter_init_fromstring(&f, "test-filter", filt)) {
+  if ((f = owl_filter_new_fromstring("test-filter", filt)) == NULL) {
     printf("not ok can't parse %s\n", filt);
     failed = 1;
     goto out;
   }
-  ok = owl_filter_message_match(&f, m);
+  ok = owl_filter_message_match(f, m);
   if((shouldmatch && !ok) || (!shouldmatch && ok)) {
     printf("not ok match %s (got %d, expected %d)\n", filt, ok, shouldmatch);
@@ -208,5 +208,5 @@
   }
  out:
-  owl_filter_free(&f);
+  owl_filter_delete(f);
   if(!failed) {
     printf("ok %s %s\n", shouldmatch ? "matches" : "doesn't match", filt);
@@ -218,5 +218,5 @@
   int numfailed=0;
   owl_message m;
-  owl_filter f1, f2, f3, f4, f5;
+  owl_filter *f1, *f2, *f3, *f4, *f5;
 
   owl_list_create(&(g.filterlist));
@@ -260,18 +260,23 @@
   TEST_FILTER("true and false or false", 0);
 
-  owl_filter_init_fromstring(&f1, "f1", "class owl");
-  owl_global_add_filter(&g, &f1);
+  f1 = owl_filter_new_fromstring("f1", "class owl");
+  owl_global_add_filter(&g, f1);
   TEST_FILTER("filter f1", 1);
+  owl_global_remove_filter(&g, "f1");
 
   /* Test recursion prevention */
-  FAIL_UNLESS("self reference", owl_filter_init_fromstring(&f2, "test", "filter test"));
+  FAIL_UNLESS("self reference", (f2 = owl_filter_new_fromstring("test", "filter test")) == NULL);
+  owl_filter_delete(f2);
 
   /* mutual recursion */
-  owl_filter_init_fromstring(&f3, "f3", "filter f4");
-  owl_global_add_filter(&g, &f3);
-  FAIL_UNLESS("mutual recursion",   owl_filter_init_fromstring(&f4, "f4", "filter f3"));
+  f3 = owl_filter_new_fromstring("f3", "filter f4");
+  owl_global_add_filter(&g, f3);
+  FAIL_UNLESS("mutual recursion", (f4 = owl_filter_new_fromstring("f4", "filter f3")) == NULL);
+  owl_global_remove_filter(&g, "f3");
+  owl_filter_delete(f4);
 
   /* support referencing a filter several times */
-  FAIL_UNLESS("DAG", !owl_filter_init_fromstring(&f5, "dag", "filter f1 or filter f1"));
+  FAIL_UNLESS("DAG", (f5 = owl_filter_new_fromstring("dag", "filter f1 or filter f1")) != NULL);
+  owl_filter_delete(f5);
 
   return 0;
