diff options
author | Yorhel <git@yorhel.nl> | 2009-04-19 12:47:22 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-04-19 12:47:22 +0200 |
commit | bb8c2e66e7c20e711fd2266854c27e47a1d6cafa (patch) | |
tree | 007c52a5799fd93eaaac4f043fa3240ab5655419 | |
parent | d8058362ecfba4b23ad7ada81f3d6df8b2b42df7 (diff) |
freedir() shouldn't need to return anything
-rw-r--r-- | src/util.c | 23 | ||||
-rw-r--r-- | src/util.h | 2 |
2 files changed, 8 insertions, 17 deletions
@@ -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; } @@ -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 *); |