From 98dbdf72b3c35878494df4954a447cec250a835d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 2 Jan 2013 22:01:04 +0100 Subject: PlaylistVector: move struct playlist_metadata to PlaylistInfo.hxx --- src/PlaylistInfo.cxx | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/PlaylistInfo.hxx | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/PlaylistVector.cxx | 23 +---------------------- src/PlaylistVector.hxx | 16 +--------------- 4 files changed, 96 insertions(+), 37 deletions(-) create mode 100644 src/PlaylistInfo.cxx create mode 100644 src/PlaylistInfo.hxx (limited to 'src') 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 + +#include + +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 + +/** + * 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 #include -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 #include #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); -- cgit v1.2.3