PlaylistVector: move struct playlist_metadata to PlaylistInfo.hxx

This commit is contained in:
Max Kellermann 2013-01-02 22:01:04 +01:00
parent 51a2d09eb7
commit 98dbdf72b3
5 changed files with 99 additions and 39 deletions

View File

@ -302,7 +302,8 @@ src_mpd_SOURCES = \
src/PlaylistSong.cxx src/PlaylistSong.hxx \ src/PlaylistSong.cxx src/PlaylistSong.hxx \
src/PlaylistState.cxx src/PlaylistState.hxx \ src/PlaylistState.cxx src/PlaylistState.hxx \
src/PlaylistQueue.cxx src/PlaylistQueue.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/PlaylistDatabase.cxx \
src/queue.c \ src/queue.c \
src/QueuePrint.cxx src/QueuePrint.hxx \ src/QueuePrint.cxx src/QueuePrint.hxx \
@ -1071,7 +1072,7 @@ test_DumpDatabase_SOURCES = test/DumpDatabase.cxx \
src/DatabaseRegistry.cxx \ src/DatabaseRegistry.cxx \
src/DatabaseSelection.cxx \ src/DatabaseSelection.cxx \
src/Directory.cxx src/DirectorySave.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/DatabaseLock.cxx src/DatabaseSave.cxx \
src/Song.cxx src/song_sort.c src/SongSave.cxx \ src/Song.cxx src/song_sort.c src/SongSave.cxx \
src/tag.c src/tag_pool.c src/TagSave.cxx \ src/tag.c src/tag_pool.c src/TagSave.cxx \

46
src/PlaylistInfo.cxx Normal file
View File

@ -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);
}

48
src/PlaylistInfo.hxx Normal file
View File

@ -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

View File

@ -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 * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -25,27 +25,6 @@
#include <string.h> #include <string.h>
#include <glib.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 void
playlist_vector_deinit(struct list_head *pv) playlist_vector_deinit(struct list_head *pv)
{ {

View File

@ -20,9 +20,9 @@
#ifndef MPD_PLAYLIST_VECTOR_HXX #ifndef MPD_PLAYLIST_VECTOR_HXX
#define MPD_PLAYLIST_VECTOR_HXX #define MPD_PLAYLIST_VECTOR_HXX
#include "PlaylistInfo.hxx"
#include "util/list.h" #include "util/list.h"
#include <stddef.h>
#include <sys/time.h> #include <sys/time.h>
#define playlist_vector_for_each(pos, head) \ #define playlist_vector_for_each(pos, head) \
@ -31,20 +31,6 @@
#define playlist_vector_for_each_safe(pos, n, head) \ #define playlist_vector_for_each_safe(pos, n, head) \
list_for_each_entry_safe(pos, n, head, siblings) 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 void
playlist_vector_deinit(struct list_head *pv); playlist_vector_deinit(struct list_head *pv);