aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-12-23 16:22:19 +0100
committerMax Kellermann <max@duempel.org>2010-12-23 16:25:05 +0100
commit4f48c10312a2e9388ca41a331787fccf262ffa4e (patch)
tree5fb1c7beeb10283b58e4eb36c9563c68af8e8ac8
parent5274fee8a71cc5901649b984bc4488c9677feadf (diff)
downloadmpd-4f48c10312a2e9388ca41a331787fccf262ffa4e.tar.gz
mpd-4f48c10312a2e9388ca41a331787fccf262ffa4e.tar.xz
mpd-4f48c10312a2e9388ca41a331787fccf262ffa4e.zip
stored_playlist: use the text_file library to read lines
-rw-r--r--src/stored_playlist.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/stored_playlist.c b/src/stored_playlist.c
index cd2818522..e9d157721 100644
--- a/src/stored_playlist.c
+++ b/src/stored_playlist.c
@@ -20,6 +20,7 @@
#include "config.h"
#include "stored_playlist.h"
#include "playlist_save.h"
+#include "text_file.h"
#include "song.h"
#include "mapper.h"
#include "path.h"
@@ -179,7 +180,6 @@ spl_load(const char *utf8path)
{
FILE *file;
GPtrArray *list;
- char buffer[MPD_PATH_MAX];
char *path_fs;
if (!spl_valid_name(utf8path) || map_spl_path() == NULL)
@@ -196,14 +196,12 @@ spl_load(const char *utf8path)
list = g_ptr_array_new();
- while (fgets(buffer, sizeof(buffer), file)) {
- char *s = buffer;
-
+ GString *buffer = g_string_sized_new(1024);
+ char *s;
+ while ((s = read_text_line(file, buffer)) != NULL) {
if (*s == PLAYLIST_COMMENT)
continue;
- g_strchomp(buffer);
-
if (!uri_has_scheme(s)) {
char *path_utf8;
struct song *song;