Permalink
Browse files

moved code to directory.c, directory.h

  • Loading branch information...
1 parent 411e60d commit 1c30f070a867fd4732712a14ee2aaf224f949511 @MaxKellermann MaxKellermann committed Nov 27, 2008
Showing with 142 additions and 58 deletions.
  1. +2 −0 Makefile.am
  2. +1 −26 include/mpd/client.h
  3. +62 −0 include/mpd/directory.h
  4. +77 −0 src/directory.c
  5. +0 −32 src/libmpdclient.c
View
@@ -7,6 +7,7 @@ mpdincludedir = $(includedir)/mpd
mpdinclude_HEADERS = \
include/mpd/client.h \
include/mpd/connection.h \
+ include/mpd/directory.h \
include/mpd/idle.h \
include/mpd/output.h \
include/mpd/return_element.h \
@@ -20,6 +21,7 @@ src_libmpdclient_la_SOURCES = \
src/str_pool.c src/str_pool.h \
src/resolver.c src/resolver.h \
src/connection.c \
+ src/directory.c \
src/output.c \
src/return_element.c \
src/idle.c \
View
@@ -35,6 +35,7 @@
#include <mpd/connection.h>
#include <mpd/song.h>
+#include <mpd/directory.h>
#ifdef WIN32
# define __W32API_USE_DLLIMPORT__ 1
@@ -165,32 +166,6 @@ mpd_SearchStats * mpd_getSearchStats(struct mpd_connection *connection);
void mpd_freeSearchStats(mpd_SearchStats * stats);
-/* DIRECTORY STUFF */
-
-/* mpd_Directory
- * used to store info fro directory (right now that just the path)
- */
-typedef struct _mpd_Directory {
- char * path;
-} mpd_Directory;
-
-/* mpd_newDirectory
- * allocates memory for a new directory
- * use mpd_freeDirectory to free this memory
- */
-mpd_Directory * mpd_newDirectory(void);
-
-/* mpd_freeDirectory
- * used to free memory allocated with mpd_newDirectory, and it frees
- * path of mpd_Directory, so be careful
- */
-void mpd_freeDirectory(mpd_Directory * directory);
-
-/* mpd_directoryDup
- * works like strdup, but for mpd_Directory
- */
-mpd_Directory * mpd_directoryDup(const mpd_Directory * directory);
-
/* PLAYLISTFILE STUFF */
/* mpd_PlaylistFile
View
@@ -0,0 +1,62 @@
+/* libmpdclient
+ (c) 2003-2008 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Music Player Daemon nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MPD_DIRECTORY_H
+#define MPD_DIRECTORY_H
+
+/* mpd_Directory
+ * used to store info fro directory (right now that just the path)
+ */
+typedef struct _mpd_Directory {
+ char * path;
+} mpd_Directory;
+
+/* mpd_newDirectory
+ * allocates memory for a new directory
+ * use mpd_freeDirectory to free this memory
+ */
+mpd_Directory *
+mpd_newDirectory(void);
+
+/* mpd_directoryDup
+ * works like strdup, but for mpd_Directory
+ */
+mpd_Directory *
+mpd_directoryDup(const mpd_Directory *directory);
+
+/* mpd_freeDirectory
+ * used to free memory allocated with mpd_newDirectory, and it frees
+ * path of mpd_Directory, so be careful
+ */
+void mpd_freeDirectory(mpd_Directory *directory);
+
+#endif
View
@@ -0,0 +1,77 @@
+/* libmpdclient
+ (c) 2003-2008 The Music Player Daemon Project
+ This project's homepage is: http://www.musicpd.org
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Music Player Daemon nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <mpd/directory.h>
+#include "str_pool.h"
+
+#include <stdlib.h>
+
+static void
+mpd_initDirectory(mpd_Directory *directory)
+{
+ directory->path = NULL;
+}
+
+static void
+mpd_finishDirectory(mpd_Directory *directory)
+{
+ if (directory->path)
+ str_pool_put(directory->path);
+}
+
+mpd_Directory *
+mpd_newDirectory(void)
+{
+ mpd_Directory * directory = malloc(sizeof(mpd_Directory));;
+
+ mpd_initDirectory(directory);
+
+ return directory;
+}
+
+void mpd_freeDirectory(mpd_Directory *directory)
+{
+ mpd_finishDirectory(directory);
+
+ free(directory);
+}
+
+mpd_Directory *
+mpd_directoryDup(const mpd_Directory *directory)
+{
+ mpd_Directory * ret = mpd_newDirectory();
+
+ if (directory->path)
+ ret->path = str_pool_dup(directory->path);
+
+ return ret;
+}
View
@@ -379,38 +379,6 @@ void mpd_freeSearchStats(mpd_SearchStats * stats)
free(stats);
}
-static void mpd_initDirectory(mpd_Directory * directory) {
- directory->path = NULL;
-}
-
-static void mpd_finishDirectory(mpd_Directory * directory) {
- if (directory->path)
- str_pool_put(directory->path);
-}
-
-mpd_Directory * mpd_newDirectory(void) {
- mpd_Directory * directory = malloc(sizeof(mpd_Directory));;
-
- mpd_initDirectory(directory);
-
- return directory;
-}
-
-void mpd_freeDirectory(mpd_Directory * directory) {
- mpd_finishDirectory(directory);
-
- free(directory);
-}
-
-mpd_Directory * mpd_directoryDup(const mpd_Directory * directory) {
- mpd_Directory * ret = mpd_newDirectory();
-
- if (directory->path)
- ret->path = str_pool_dup(directory->path);
-
- return ret;
-}
-
static void mpd_initPlaylistFile(mpd_PlaylistFile * playlist) {
playlist->path = NULL;
}

0 comments on commit 1c30f07

Please sign in to comment.