aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory_save.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-01-24 18:20:58 +0100
committerMax Kellermann <max@duempel.org>2012-01-24 20:49:53 +0100
commitd99f074eb73d5228528961a78c13419c2c4c26ae (patch)
tree26749b6a0feb81d1bda7d0e1511d38ba1716cfcd /src/directory_save.c
parenta989140a0767823fcec4ef745b639b92838413f9 (diff)
downloadmpd-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.c7
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);