diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | src/PlaylistInfo.cxx | 46 | ||||
-rw-r--r-- | src/PlaylistInfo.hxx | 48 | ||||
-rw-r--r-- | src/PlaylistVector.cxx | 23 | ||||
-rw-r--r-- | src/PlaylistVector.hxx | 16 |
5 files changed, 99 insertions, 39 deletions
diff --git a/Makefile.am b/Makefile.am index 5cbc44da2..28d39cfe7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -302,7 +302,8 @@ src_mpd_SOURCES = \ src/PlaylistSong.cxx src/PlaylistSong.hxx \ src/PlaylistState.cxx src/PlaylistState.hxx \ src/PlaylistQueue.cxx src/PlaylistQueue.hxx \ - src/PlaylistVector.cxx \ + src/PlaylistVector.cxx src/PlaylistVector.hxx \ + src/PlaylistInfo.cxx src/PlaylistInfo.hxx \ src/PlaylistDatabase.cxx \ src/queue.c \ src/QueuePrint.cxx src/QueuePrint.hxx \ @@ -1071,7 +1072,7 @@ test_DumpDatabase_SOURCES = test/DumpDatabase.cxx \ src/DatabaseRegistry.cxx \ src/DatabaseSelection.cxx \ src/Directory.cxx src/DirectorySave.cxx \ - src/PlaylistVector.cxx src/PlaylistDatabase.cxx \ + src/PlaylistVector.cxx src/PlaylistInfo.cxx src/PlaylistDatabase.cxx \ src/DatabaseLock.cxx src/DatabaseSave.cxx \ src/Song.cxx src/song_sort.c src/SongSave.cxx \ src/tag.c src/tag_pool.c src/TagSave.cxx \ diff --git a/src/PlaylistInfo.cxx b/src/PlaylistInfo.cxx new file mode 100644 index 000000000..392178795 --- /dev/null +++ b/src/PlaylistInfo.cxx @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "PlaylistInfo.hxx" + +#include <glib.h> + +#include <assert.h> + +struct playlist_metadata * +playlist_metadata_new(const char *name, time_t mtime) +{ + assert(name != NULL); + + struct playlist_metadata *pm = g_slice_new(struct playlist_metadata); + pm->name = g_strdup(name); + pm->mtime = mtime; + return pm; +} + +void +playlist_metadata_free(struct playlist_metadata *pm) +{ + assert(pm != NULL); + assert(pm->name != NULL); + + g_free(pm->name); + g_slice_free(struct playlist_metadata, pm); +} diff --git a/src/PlaylistInfo.hxx b/src/PlaylistInfo.hxx new file mode 100644 index 000000000..2d21178ed --- /dev/null +++ b/src/PlaylistInfo.hxx @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2003-2013 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_PLAYLIST_INFO_HXX +#define MPD_PLAYLIST_INFO_HXX + +#include "check.h" +#include "util/list.h" + +#include <sys/time.h> + +/** + * A directory entry pointing to a playlist file. + */ +struct playlist_metadata { + struct list_head siblings; + + /** + * The UTF-8 encoded name of the playlist file. + */ + char *name; + + time_t mtime; +}; + +struct playlist_metadata * +playlist_metadata_new(const char *name, time_t mtime); + +void +playlist_metadata_free(struct playlist_metadata *pm); + +#endif diff --git a/src/PlaylistVector.cxx b/src/PlaylistVector.cxx index b9f671929..726a69337 100644 --- a/src/PlaylistVector.cxx +++ b/src/PlaylistVector.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -25,27 +25,6 @@ #include <string.h> #include <glib.h> -static struct playlist_metadata * -playlist_metadata_new(const char *name, time_t mtime) -{ - assert(name != NULL); - - struct playlist_metadata *pm = g_slice_new(struct playlist_metadata); - pm->name = g_strdup(name); - pm->mtime = mtime; - return pm; -} - -static void -playlist_metadata_free(struct playlist_metadata *pm) -{ - assert(pm != NULL); - assert(pm->name != NULL); - - g_free(pm->name); - g_slice_free(struct playlist_metadata, pm); -} - void playlist_vector_deinit(struct list_head *pv) { diff --git a/src/PlaylistVector.hxx b/src/PlaylistVector.hxx index 00347ffdb..30418131a 100644 --- a/src/PlaylistVector.hxx +++ b/src/PlaylistVector.hxx @@ -20,9 +20,9 @@ #ifndef MPD_PLAYLIST_VECTOR_HXX #define MPD_PLAYLIST_VECTOR_HXX +#include "PlaylistInfo.hxx" #include "util/list.h" -#include <stddef.h> #include <sys/time.h> #define playlist_vector_for_each(pos, head) \ @@ -31,20 +31,6 @@ #define playlist_vector_for_each_safe(pos, n, head) \ list_for_each_entry_safe(pos, n, head, siblings) -/** - * A directory entry pointing to a playlist file. - */ -struct playlist_metadata { - struct list_head siblings; - - /** - * The UTF-8 encoded name of the playlist file. - */ - char *name; - - time_t mtime; -}; - void playlist_vector_deinit(struct list_head *pv); |