From d5c132fca03ae50eecbeac60524f981eb9d2d81a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Jul 2018 18:25:27 +0200 Subject: [PATCH] db/update/ExcludeList: move code to ParseLine() --- src/db/update/ExcludeList.cxx | 23 ++++++++++++++--------- src/db/update/ExcludeList.hxx | 3 +++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/db/update/ExcludeList.cxx b/src/db/update/ExcludeList.cxx index e54999f8c..ec44250eb 100644 --- a/src/db/update/ExcludeList.cxx +++ b/src/db/update/ExcludeList.cxx @@ -35,6 +35,18 @@ #include #include +inline void +ExcludeList::ParseLine(char *line) noexcept +{ + char *p = strchr(line, '#'); + if (p != nullptr) + *p = 0; + + p = Strip(line); + if (*p != 0) + patterns.emplace_front(p); +} + bool ExcludeList::LoadFile(Path path_fs) noexcept try { @@ -42,15 +54,8 @@ try { TextFile file(path_fs); char *line; - while ((line = file.ReadLine()) != nullptr) { - char *p = strchr(line, '#'); - if (p != nullptr) - *p = 0; - - p = Strip(line); - if (*p != 0) - patterns.emplace_front(p); - } + while ((line = file.ReadLine()) != nullptr) + ParseLine(line); #else /* not implemented */ (void)path_fs; diff --git a/src/db/update/ExcludeList.hxx b/src/db/update/ExcludeList.hxx index 793a3a162..d27f1c888 100644 --- a/src/db/update/ExcludeList.hxx +++ b/src/db/update/ExcludeList.hxx @@ -69,6 +69,9 @@ public: * the specified file name. */ bool Check(Path name_fs) const noexcept; + +private: + void ParseLine(char *line) noexcept; };