From 6e02f75262f13b750e6aca5e74db34ffc4766eb9 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 6 May 2016 10:18:28 -0400 Subject: [PATCH] core/tags/library: Add a pointer to store a playlist I decided to set this as a void pointer to keep other layers from using the playlist without our knowledge. The only user of this variable should be the playlist code. Signed-off-by: Anna Schumaker --- core/tags/library.c | 7 ++++--- include/core/tags/library.h | 9 +++++---- tests/core/tags/library.c | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/tags/library.c b/core/tags/library.c index 08b4ad8f..0fa806dd 100644 --- a/core/tags/library.c +++ b/core/tags/library.c @@ -11,9 +11,10 @@ static struct library *__library_alloc(gchar *path, bool enabled) struct library *library = g_malloc(sizeof(struct library)); dbe_init(&library->li_dbe, library); - library->li_size = 0; - library->li_enabled = enabled; - library->li_path = path; + library->li_size = 0; + library->li_enabled = enabled; + library->li_path = path; + library->li_playlist = NULL; return library; } diff --git a/include/core/tags/library.h b/include/core/tags/library.h index e9e1a242..0421d31f 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -16,10 +16,11 @@ #include struct library { - unsigned int li_size; /* This library's track count. */ - bool li_enabled;/* True if this library is enabled. */ - gchar *li_path; /* This library's root path. */ - struct db_entry li_dbe; + unsigned int li_size; /* This library's track count. */ + bool li_enabled; /* True if this library is enabled. */ + gchar *li_path; /* This library's root path. */ + void *li_playlist; /* This library's associated playlist. */ + struct db_entry li_dbe; }; #define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe)) diff --git a/tests/core/tags/library.c b/tests/core/tags/library.c index 3c16a9b4..1e1a809c 100644 --- a/tests/core/tags/library.c +++ b/tests/core/tags/library.c @@ -9,6 +9,7 @@ static void test_verify_zelda(struct library *library) const struct db_ops *library_ops = test_library_ops(); test_equal(library->li_enabled, (bool)true); test_equal(library->li_size, 0); + test_equal(library->li_playlist, NULL); test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Zelda/Music"); } @@ -17,6 +18,7 @@ static void test_verify_link(struct library *library) const struct db_ops *library_ops = test_library_ops(); test_equal(library->li_enabled, (bool)false); test_equal(library->li_size, 0); + test_equal(library->li_playlist, NULL); test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Link/Music"); }