diff options
author | Max Kellermann <max@duempel.org> | 2008-12-28 19:54:49 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-12-28 19:54:49 +0100 |
commit | 859aac7242fe3767c19c1bfff73d5e6159cbad31 (patch) | |
tree | 2e433f6ec1a820d99ad171ffd6a49a6828ddd0e4 /src/playlist.c | |
parent | 2598cdd86814c7792a431470a9143d609399697b (diff) | |
download | mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.tar.gz mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.tar.xz mpd-859aac7242fe3767c19c1bfff73d5e6159cbad31.zip |
utils: removed myFgets()
Replaced myFgets() with fgets() + g_strchomp().
Diffstat (limited to '')
-rw-r--r-- | src/playlist.c | 13 |
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) { |