diff options
author | Max Kellermann <max@duempel.org> | 2013-01-03 10:16:05 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-03 10:16:05 +0100 |
commit | 90fe4c5124e3fd335f05804d3cc47ba996e62b14 (patch) | |
tree | ef7fb6b3cb2edbe4898431db611f04fb281129fc /src/PlaylistFile.cxx | |
parent | 2452447c814048ed72e95a459c76b4be65962b5c (diff) | |
download | mpd-90fe4c5124e3fd335f05804d3cc47ba996e62b14.tar.gz mpd-90fe4c5124e3fd335f05804d3cc47ba996e62b14.tar.xz mpd-90fe4c5124e3fd335f05804d3cc47ba996e62b14.zip |
TextFile: convert to a class
Diffstat (limited to 'src/PlaylistFile.cxx')
-rw-r--r-- | src/PlaylistFile.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index e03cc5e54..67ffdff4f 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -236,16 +236,14 @@ LoadPlaylistFile(const char *utf8path, GError **error_r) if (path_fs == NULL) return contents; - FILE *file = fopen(path_fs, "r"); - g_free(path_fs); - if (file == NULL) { + TextFile file(path_fs); + if (file.HasFailed()) { playlist_errno(error_r); return contents; } - GString *buffer = g_string_sized_new(1024); char *s; - while ((s = read_text_line(file, buffer)) != NULL) { + while ((s = file.ReadLine()) != NULL) { if (*s == 0 || *s == PLAYLIST_COMMENT) continue; @@ -265,7 +263,6 @@ LoadPlaylistFile(const char *utf8path, GError **error_r) break; } - fclose(file); return contents; } |