db/update/InotifyQueue: use StringAfterPrefix()
This commit is contained in:
parent
3dc989bccb
commit
e7ef7f5159
@ -24,8 +24,6 @@
|
|||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
#include "util/StringCompare.hxx"
|
#include "util/StringCompare.hxx"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait this long after the last change before calling
|
* Wait this long after the last change before calling
|
||||||
* update_enqueue(). This increases the probability that updates can
|
* update_enqueue(). This increases the probability that updates can
|
||||||
@ -55,14 +53,16 @@ InotifyQueue::OnTimeout()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
static bool
|
static bool
|
||||||
path_in(const char *path, const char *possible_parent)
|
path_in(const char *path, const char *possible_parent)
|
||||||
{
|
{
|
||||||
size_t length = strlen(possible_parent);
|
if (StringIsEmpty(path))
|
||||||
|
return true;
|
||||||
|
|
||||||
return StringIsEmpty(path) ||
|
auto rest = StringAfterPrefix(path, possible_parent);
|
||||||
(memcmp(possible_parent, path, length) == 0 &&
|
return rest != nullptr &&
|
||||||
(path[length] == 0 || path[length] == '/'));
|
(StringIsEmpty(rest) || rest[0] == '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user