summaryrefslogtreecommitdiff
path: root/src/directory.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-01-24 21:33:09 +0100
committerMax Kellermann <max@duempel.org>2012-01-24 22:26:43 +0100
commit84ba14fa294f43b5dc75f899533d0596031aabd6 (patch)
tree151a64e2e827f6f07791dd5642b88bab5d421dc8 /src/directory.h
parent3c75963352734dc33a0d6c833e9d5e1493d0e0d9 (diff)
directory: replace songvec with doubly linked list
Diffstat (limited to 'src/directory.h')
-rw-r--r--src/directory.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/directory.h b/src/directory.h
index b866295ae..5460cb46a 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -22,7 +22,6 @@
#include "check.h"
#include "util/list.h"
-#include "songvec.h"
#include "playlist_vector.h"
#include <glib.h>
@@ -40,6 +39,13 @@
#define directory_for_each_child_safe(pos, n, directory) \
list_for_each_entry_safe(pos, n, &directory->children, siblings)
+#define directory_for_each_song(pos, directory) \
+ list_for_each_entry(pos, &directory->songs, siblings)
+
+#define directory_for_each_song_safe(pos, n, directory) \
+ list_for_each_entry_safe(pos, n, &directory->songs, siblings)
+
+struct song;
struct db_visitor;
struct directory {
@@ -61,7 +67,13 @@ struct directory {
*/
struct list_head children;
- struct songvec songs;
+ /**
+ * A doubly linked list of songs within this directory.
+ *
+ * This attribute is protected with the global #db_mutex.
+ * Read access in the update thread does not need protection.
+ */
+ struct list_head songs;
struct playlist_vector playlists;
@@ -114,7 +126,7 @@ static inline bool
directory_is_empty(const struct directory *directory)
{
return list_empty(&directory->children) &&
- directory->songs.nr == 0 &&
+ list_empty(&directory->songs) &&
playlist_vector_is_empty(&directory->playlists);
}