From 90fe4c5124e3fd335f05804d3cc47ba996e62b14 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 10:16:05 +0100 Subject: TextFile: convert to a class --- src/PlaylistFile.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/PlaylistFile.cxx') diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index e03cc5e5..67ffdff4 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; } -- cgit v1.2.3