aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-28 19:54:49 +0100
committerMax Kellermann <max@duempel.org>2008-12-28 19:54:49 +0100
commit859aac7242fe3767c19c1bfff73d5e6159cbad31 (patch)
tree2e433f6ec1a820d99ad171ffd6a49a6828ddd0e4 /src/playlist.c
parent2598cdd86814c7792a431470a9143d609399697b (diff)
downloadmpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.tar.gz
mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.tar.xz
mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.zip
utils: removed myFgets()
Replaced myFgets() with fgets() + g_strchomp().
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/playlist.c b/src/playlist.c
index ba69844de..18068b77c 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -268,9 +268,11 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer,
char *temp;
int song;
- if (!myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp))
+ if (!fgets(buffer, PLAYLIST_BUFFER_SIZE, fp))
state_file_fatal();
- while (strcmp(buffer, PLAYLIST_STATE_FILE_PLAYLIST_END)) {
+ while (!g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_PLAYLIST_END)) {
+ g_strchomp(buffer);
+
temp = strtok(buffer, ":");
if (temp == NULL)
state_file_fatal();
@@ -290,7 +292,8 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer,
seek_time);
}
}
- if (!myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp))
+
+ if (!fgets(buffer, PLAYLIST_BUFFER_SIZE, fp))
state_file_fatal();
}
}
@@ -302,7 +305,9 @@ void readPlaylistState(FILE *fp)
int state = PLAYER_STATE_STOP;
char buffer[PLAYLIST_BUFFER_SIZE];
- while (myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) {
+ while (fgets(buffer, sizeof(buffer), fp)) {
+ g_strchomp(buffer);
+
if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_STATE)) {
if (strcmp(&(buffer[strlen(PLAYLIST_STATE_FILE_STATE)]),
PLAYLIST_STATE_FILE_STATE_PLAY) == 0) {