aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c2
-rw-r--r--src/playlist.c14
-rw-r--r--src/playlist.h2
-rw-r--r--src/stored_playlist.c15
-rw-r--r--src/stored_playlist.h3
5 files changed, 19 insertions, 17 deletions
diff --git a/src/command.c b/src/command.c
index 2f567e25b..dc5c3f96a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -626,7 +626,7 @@ handle_rm(struct client *client, mpd_unused int argc, char *argv[])
{
enum playlist_result result;
- result = deletePlaylist(argv[1]);
+ result = spl_delete(argv[1]);
return print_playlist_result(client, result);
}
diff --git a/src/playlist.c b/src/playlist.c
index 4b7ea6074..0baebc6ea 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1185,20 +1185,6 @@ void shufflePlaylist(void)
}
}
-enum playlist_result deletePlaylist(const char *utf8file)
-{
- char path_max_tmp[MPD_PATH_MAX];
-
- utf8_to_fs_playlist_path(path_max_tmp, utf8file);
-
- if (unlink(path_max_tmp) < 0)
- return errno == ENOENT
- ? PLAYLIST_RESULT_NO_SUCH_LIST
- : PLAYLIST_RESULT_ERRNO;
-
- return PLAYLIST_RESULT_SUCCESS;
-}
-
enum playlist_result savePlaylist(const char *utf8file)
{
FILE *fp;
diff --git a/src/playlist.h b/src/playlist.h
index 5e75cc68b..4e9929854 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -109,8 +109,6 @@ void shufflePlaylist(void);
enum playlist_result savePlaylist(const char *utf8file);
-enum playlist_result deletePlaylist(const char *utf8file);
-
void
deleteASongFromPlaylist(const struct song *song);
diff --git a/src/stored_playlist.c b/src/stored_playlist.c
index cb81962d1..61d4d8cc3 100644
--- a/src/stored_playlist.c
+++ b/src/stored_playlist.c
@@ -266,6 +266,21 @@ spl_clear(const char *utf8path)
}
enum playlist_result
+spl_delete(const char *name_utf8)
+{
+ char filename[MPD_PATH_MAX];
+
+ utf8_to_fs_playlist_path(filename, name_utf8);
+
+ if (unlink(filename) < 0)
+ return errno == ENOENT
+ ? PLAYLIST_RESULT_NO_SUCH_LIST
+ : PLAYLIST_RESULT_ERRNO;
+
+ return PLAYLIST_RESULT_SUCCESS;
+}
+
+enum playlist_result
spl_remove_index(const char *utf8path, unsigned pos)
{
GPtrArray *list;
diff --git a/src/stored_playlist.h b/src/stored_playlist.h
index 8ba756853..1ac5c33af 100644
--- a/src/stored_playlist.h
+++ b/src/stored_playlist.h
@@ -54,6 +54,9 @@ enum playlist_result
spl_clear(const char *utf8path);
enum playlist_result
+spl_delete(const char *name_utf8);
+
+enum playlist_result
spl_remove_index(const char *utf8path, unsigned pos);
enum playlist_result