file_rules_delete function
authorChristian Thaeter <ct@pipapo.org>
Sun, 21 Oct 2007 13:17:27 +0000 (15:17 +0200)
committerChristian Thaeter <ct@pipapo.org>
Sun, 21 Oct 2007 13:17:27 +0000 (15:17 +0200)
src/rxpd.h
src/rxpd_file.c

index 60dc441..4ccf228 100644 (file)
@@ -144,6 +144,9 @@ rxpd_file_new (struct rxpd_base* base, const char* filename);
 void
 rxpd_file_delete (struct rxpd_file* file);
 
+struct rxpd_file*
+rxpd_file_rules_delete (struct rxpd_file* self);
+
 int
 rxpd_file_load (struct rxpd_file* self);
 
index d49644b..d0341b1 100644 (file)
@@ -58,6 +58,18 @@ rxpd_file_new (struct rxpd_base* base, const char* filename)
 
 void
 rxpd_file_delete (struct rxpd_file* self)
+{
+  if (self)
+    {
+      rxpd_file_rules_delete (self);
+      psplay_remove (&self->base->files, &self->node);
+      free ((void*)self->filename);
+      free (self);
+    }
+}
+
+struct rxpd_file*
+rxpd_file_rules_delete (struct rxpd_file* self)
 {
   if (self)
     {
@@ -66,10 +78,8 @@ rxpd_file_delete (struct rxpd_file* self)
           struct rxpd_rule* node = (struct rxpd_rule*)n;
           rxpd_rule_delete (node);
         }
-      psplay_remove (&self->base->files, &self->node);
-      free ((void*)self->filename);
-      free (self);
     }
+  return self;
 }
 
 int