Commit e7ef7f51 authored by Max Kellermann's avatar Max Kellermann

db/update/InotifyQueue: use StringAfterPrefix()

parent 3dc989bc
......@@ -24,8 +24,6 @@
#include "Log.hxx"
#include "util/StringCompare.hxx"
#include <string.h>
/**
* Wait this long after the last change before calling
* update_enqueue(). This increases the probability that updates can
......@@ -55,14 +53,16 @@ InotifyQueue::OnTimeout()
}
}
gcc_pure
static bool
path_in(const char *path, const char *possible_parent)
{
size_t length = strlen(possible_parent);
if (StringIsEmpty(path))
return true;
return StringIsEmpty(path) ||
(memcmp(possible_parent, path, length) == 0 &&
(path[length] == 0 || path[length] == '/'));
auto rest = StringAfterPrefix(path, possible_parent);
return rest != nullptr &&
(StringIsEmpty(rest) || rest[0] == '/');
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment