From c53492a76a8a05825e1c7f699c05645eee891199 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 1 Oct 2013 18:31:22 +0200 Subject: TextFile: don't include glib.h in header Un-inline the methods that use GLib. --- src/TextFile.cxx | 16 ++++++++++++++++ src/TextFile.hxx | 18 ++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/TextFile.cxx b/src/TextFile.cxx index 4ad59ee4a..da0b33816 100644 --- a/src/TextFile.cxx +++ b/src/TextFile.cxx @@ -19,10 +19,26 @@ #include "config.h" #include "TextFile.hxx" +#include "fs/Path.hxx" +#include "fs/FileSystem.hxx" + +#include #include #include +TextFile::TextFile(const Path &path_fs) + :file(FOpen(path_fs, FOpenMode::ReadText)), + buffer(g_string_sized_new(step)) {} + +TextFile::~TextFile() +{ + if (file != nullptr) + fclose(file); + + g_string_free(buffer, true); +} + char * TextFile::ReadLine() { diff --git a/src/TextFile.hxx b/src/TextFile.hxx index d593e0961..6aff4ca70 100644 --- a/src/TextFile.hxx +++ b/src/TextFile.hxx @@ -21,10 +21,11 @@ #define MPD_TEXT_FILE_HXX #include "gcc.h" -#include "fs/Path.hxx" -#include "fs/FileSystem.hxx" -#include +#include + +class Path; +typedef struct _GString GString; class TextFile { static constexpr size_t max_length = 512 * 1024; @@ -35,18 +36,11 @@ class TextFile { GString *const buffer; public: - TextFile(const Path &path_fs) - :file(FOpen(path_fs, FOpenMode::ReadText)), - buffer(g_string_sized_new(step)) {} + TextFile(const Path &path_fs); TextFile(const TextFile &other) = delete; - ~TextFile() { - if (file != nullptr) - fclose(file); - - g_string_free(buffer, true); - } + ~TextFile(); bool HasFailed() const { return gcc_unlikely(file == nullptr); -- cgit v1.2.3