db/update/InotifyQueue: use StringAfterPrefix()
This commit is contained in:
parent
3dc989bccb
commit
e7ef7f5159
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user