From 7ccc609da2219d414dbed6c55cfdb9d52b359823 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 1 Mar 2014 08:16:13 +0100 Subject: db/update/ExcludeList: make no-op if GLib is disabled Quick hack to allow using the database without GLib (for Android). --- src/db/update/ExcludeList.cxx | 10 ++++++++++ src/db/update/ExcludeList.hxx | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/db/update/ExcludeList.cxx b/src/db/update/ExcludeList.cxx index 0a5fbac9f..cf92ac8f7 100644 --- a/src/db/update/ExcludeList.cxx +++ b/src/db/update/ExcludeList.cxx @@ -39,6 +39,7 @@ static constexpr Domain exclude_list_domain("exclude_list"); bool ExcludeList::LoadFile(Path path_fs) { +#ifdef HAVE_GLIB FILE *file = FOpen(path_fs, FOpenMode::ReadText); if (file == nullptr) { const int e = errno; @@ -64,6 +65,10 @@ ExcludeList::LoadFile(Path path_fs) } fclose(file); +#else + // TODO: implement + (void)path_fs; +#endif return true; } @@ -75,9 +80,14 @@ ExcludeList::Check(Path name_fs) const /* XXX include full path name in check */ +#ifdef HAVE_GLIB for (const auto &i : patterns) if (i.Check(name_fs.c_str())) return true; +#else + // TODO: implement + (void)name_fs; +#endif return false; } diff --git a/src/db/update/ExcludeList.hxx b/src/db/update/ExcludeList.hxx index 8870664b0..ef6c4d53e 100644 --- a/src/db/update/ExcludeList.hxx +++ b/src/db/update/ExcludeList.hxx @@ -25,15 +25,19 @@ #ifndef MPD_EXCLUDE_H #define MPD_EXCLUDE_H +#include "check.h" #include "Compiler.h" #include +#ifdef HAVE_GLIB #include +#endif class Path; class ExcludeList { +#ifdef HAVE_GLIB class Pattern { GPatternSpec *pattern; @@ -57,11 +61,19 @@ class ExcludeList { }; std::forward_list patterns; +#else + // TODO: implement +#endif public: gcc_pure bool IsEmpty() const { +#ifdef HAVE_GLIB return patterns.empty(); +#else + // TODO: implement + return true; +#endif } /** -- cgit v1.2.3