diff options
author | Max Kellermann <max@duempel.org> | 2012-01-24 18:20:58 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-01-24 20:49:53 +0100 |
commit | d99f074eb73d5228528961a78c13419c2c4c26ae (patch) | |
tree | 26749b6a0feb81d1bda7d0e1511d38ba1716cfcd /src/directory_save.c | |
parent | a989140a0767823fcec4ef745b639b92838413f9 (diff) | |
download | mpd-d99f074eb73d5228528961a78c13419c2c4c26ae.tar.gz mpd-d99f074eb73d5228528961a78c13419c2c4c26ae.tar.xz mpd-d99f074eb73d5228528961a78c13419c2c4c26ae.zip |
directory: replace dirvec with doubly linked list
Random access is not needed, and a linked list is easier to manage: we
don't need to (re-)allocate the pointer array.
Diffstat (limited to '')
-rw-r--r-- | src/directory_save.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/directory_save.c b/src/directory_save.c index 975e2e745..087c99fe4 100644 --- a/src/directory_save.c +++ b/src/directory_save.c @@ -44,8 +44,6 @@ directory_quark(void) void directory_save(FILE *fp, const struct directory *directory) { - size_t i; - if (!directory_is_root(directory)) { fprintf(fp, DIRECTORY_MTIME "%lu\n", (unsigned long)directory->mtime); @@ -54,9 +52,8 @@ directory_save(FILE *fp, const struct directory *directory) directory_get_path(directory)); } - const struct dirvec *children = &directory->children; - for (i = 0; i < children->nr; ++i) { - const struct directory *cur = children->base[i]; + struct directory *cur; + directory_for_each_child(cur, directory) { char *base = g_path_get_basename(cur->path); fprintf(fp, DIRECTORY_DIR "%s\n", base); |