aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-06 09:49:39 +0100
committerMax Kellermann <max@duempel.org>2015-11-06 09:49:39 +0100
commite7ef7f51592e384d4a2ecd2e57af56053fb57e42 (patch)
tree5ffa14709e1a6be12cace938d7cadedb4e440022 /src
parent3dc989bccb396daf87c2b3791079e5ba92b5aba4 (diff)
downloadmpd-e7ef7f51592e384d4a2ecd2e57af56053fb57e42.tar.gz
mpd-e7ef7f51592e384d4a2ecd2e57af56053fb57e42.tar.xz
mpd-e7ef7f51592e384d4a2ecd2e57af56053fb57e42.zip
db/update/InotifyQueue: use StringAfterPrefix()
Diffstat (limited to '')
-rw-r--r--src/db/update/InotifyQueue.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/db/update/InotifyQueue.cxx b/src/db/update/InotifyQueue.cxx
index 392ac4110..3ed7d3d13 100644
--- a/src/db/update/InotifyQueue.cxx
+++ b/src/db/update/InotifyQueue.cxx
@@ -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