diff options
author | Max Kellermann <max@duempel.org> | 2008-10-23 09:54:32 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-23 09:54:32 +0200 |
commit | 93598e28f48a6a2da332287a3b8c0966a99e66d9 (patch) | |
tree | c8c5a6b691d7c1b99f0555332ba344b485367f73 /src | |
parent | 39f0c41fbf94f2ac078478867ff95a92a62480fb (diff) | |
download | mpd-93598e28f48a6a2da332287a3b8c0966a99e66d9.tar.gz mpd-93598e28f48a6a2da332287a3b8c0966a99e66d9.tar.xz mpd-93598e28f48a6a2da332287a3b8c0966a99e66d9.zip |
stored_playlist: renamed and moved spl_delete() to stored_playlist.c
The function deletePlaylist() shouldn't be in playlist.c.
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 2 | ||||
-rw-r--r-- | src/playlist.c | 14 | ||||
-rw-r--r-- | src/playlist.h | 2 | ||||
-rw-r--r-- | src/stored_playlist.c | 15 | ||||
-rw-r--r-- | src/stored_playlist.h | 3 |
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 |