WIP: pth transistion, 3rd step, commands basically ported
[rxpd] / src / rxpd_file.c
index 75b551d0df88cdbb91d57be3774600690e9ee5f0..d0341b15cb10e84fbac909e2c970c1e6204fbb8d 100644 (file)
@@ -57,19 +57,29 @@ rxpd_file_new (struct rxpd_base* base, const char* filename)
 }
 
 void
-rxpd_file_delete (PSplay f)
+rxpd_file_delete (struct rxpd_file* self)
 {
-  if (f)
+  if (self)
     {
-      struct rxpd_file* file = (struct rxpd_file*)f;
-      LLIST_WHILE_HEAD (&file->rules, n)
+      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)
+    {
+      LLIST_WHILE_HEAD (&self->rules, n)
         {
           struct rxpd_rule* node = (struct rxpd_rule*)n;
           rxpd_rule_delete (node);
         }
-      free ((void*)file->filename);
-      free (f);
     }
+  return self;
 }
 
 int