summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-04-19 12:47:22 +0200
committerYorhel <git@yorhel.nl>2009-04-19 12:47:22 +0200
commitbb8c2e66e7c20e711fd2266854c27e47a1d6cafa (patch)
tree007c52a5799fd93eaaac4f043fa3240ab5655419
parentd8058362ecfba4b23ad7ada81f3d6df8b2b42df7 (diff)
freedir() shouldn't need to return anything
-rw-r--r--src/util.c23
-rw-r--r--src/util.h2
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 *);