From bb8c2e66e7c20e711fd2266854c27e47a1d6cafa Mon Sep 17 00:00:00 2001
From: Yorhel <git@yorhel.nl>
Date: Sun, 19 Apr 2009 12:47:22 +0200
Subject: [PATCH] freedir() shouldn't need to return anything

---
 src/util.c | 23 +++++++----------------
 src/util.h |  2 +-
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/util.c b/src/util.c
index 8efcabe..d6002fa 100644
--- a/src/util.c
+++ b/src/util.c
@@ -176,8 +176,8 @@ void freedir_rec(struct dir *dr) {
 }
 
 
-struct dir *freedir(struct dir *dr) {
-  struct dir *tmp, *cur;
+void freedir(struct dir *dr) {
+  struct dir *tmp;
 
   /* update sizes of parent directories */
   tmp = dr;
@@ -187,33 +187,24 @@ struct dir *freedir(struct dir *dr) {
     tmp->items -= dr->items+1;
   }
 
-  /* free dr->sub recursive */
-  if(dr->sub) freedir_rec(dr->sub);
+  /* free dr->sub recursively */
+  if(dr->sub)
+    freedir_rec(dr->sub);
  
   /* update references */
-  cur = NULL;
   if(dr->parent) {
     /* item is at the top of the dir, refer to next item */
-    if(dr->parent->sub == dr) {
+    if(dr->parent->sub == dr)
       dr->parent->sub = dr->next;
-      cur = dr->next;
-    }
     /* else, get the previous item and update it's "next"-reference */
     else
       for(tmp = dr->parent->sub; tmp != NULL; tmp = tmp->next)
-        if(tmp->next == dr) {
+        if(tmp->next == dr)
           tmp->next = dr->next;
-          cur = tmp;
-        }
-    /* no previous item, refer to parent dir */
-    if(cur == NULL && dr->parent->parent)
-      cur = dr->parent;
   }
 
   free(dr->name);
   free(dr);
-
-  return cur;
 }
 
 
diff --git a/src/util.h b/src/util.h
index fa48289..72f3038 100644
--- a/src/util.h
+++ b/src/util.h
@@ -72,7 +72,7 @@ char *formatsize(const off_t);
 char *fullsize(const off_t);
 
 /* recursively free()s a directory tree */
-struct dir *freedir(struct dir *);
+void freedir(struct dir *);
 
 /* generates full path from a dir item */
 char *getpath(struct dir *, char *);
-- 
GitLab