db/update/ExcludeList: move code to ParseLine()

This commit is contained in:
Max Kellermann 2018-07-06 18:25:27 +02:00
parent 5f082a2739
commit d5c132fca0
2 changed files with 17 additions and 9 deletions

View File

@ -35,6 +35,18 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
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 bool
ExcludeList::LoadFile(Path path_fs) noexcept ExcludeList::LoadFile(Path path_fs) noexcept
try { try {
@ -42,15 +54,8 @@ try {
TextFile file(path_fs); TextFile file(path_fs);
char *line; char *line;
while ((line = file.ReadLine()) != nullptr) { while ((line = file.ReadLine()) != nullptr)
char *p = strchr(line, '#'); ParseLine(line);
if (p != nullptr)
*p = 0;
p = Strip(line);
if (*p != 0)
patterns.emplace_front(p);
}
#else #else
/* not implemented */ /* not implemented */
(void)path_fs; (void)path_fs;

View File

@ -69,6 +69,9 @@ public:
* the specified file name. * the specified file name.
*/ */
bool Check(Path name_fs) const noexcept; bool Check(Path name_fs) const noexcept;
private:
void ParseLine(char *line) noexcept;
}; };