diff options
author | Max Kellermann <max@duempel.org> | 2015-11-06 09:37:07 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-11-06 09:37:07 +0100 |
commit | c880099deb41c09ea7844daa27a42dac4142c0cd (patch) | |
tree | 571482d1e6e7efc95ab7d443f246232188d3c23f /src/db | |
parent | 42f5ecd4a116c96d30bf407859dadaa9a053ea39 (diff) | |
download | mpd-c880099deb41c09ea7844daa27a42dac4142c0cd.tar.gz mpd-c880099deb41c09ea7844daa27a42dac4142c0cd.tar.xz mpd-c880099deb41c09ea7844daa27a42dac4142c0cd.zip |
util/StringCompare: add StringIsEmpty()
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/update/Archive.cxx | 3 | ||||
-rw-r--r-- | src/db/update/InotifyQueue.cxx | 3 | ||||
-rw-r--r-- | src/db/update/Walk.cxx | 3 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/db/update/Archive.cxx b/src/db/update/Archive.cxx index e818ab279..78ebbdb10 100644 --- a/src/db/update/Archive.cxx +++ b/src/db/update/Archive.cxx @@ -31,6 +31,7 @@ #include "archive/ArchiveFile.hxx" #include "archive/ArchiveVisitor.hxx" #include "util/Error.hxx" +#include "util/StringCompare.hxx" #include "Log.hxx" #include <string> @@ -54,7 +55,7 @@ UpdateWalk::UpdateArchiveTree(Directory &directory, const char *name) //create directories first UpdateArchiveTree(*subdir, tmp + 1); } else { - if (strlen(name) == 0) { + if (StringIsEmpty(name)) { LogWarning(update_domain, "archive returned directory only"); return; diff --git a/src/db/update/InotifyQueue.cxx b/src/db/update/InotifyQueue.cxx index 4b5269427..392ac4110 100644 --- a/src/db/update/InotifyQueue.cxx +++ b/src/db/update/InotifyQueue.cxx @@ -22,6 +22,7 @@ #include "InotifyDomain.hxx" #include "Service.hxx" #include "Log.hxx" +#include "util/StringCompare.hxx" #include <string.h> @@ -59,7 +60,7 @@ path_in(const char *path, const char *possible_parent) { size_t length = strlen(possible_parent); - return path[0] == 0 || + return StringIsEmpty(path) || (memcmp(possible_parent, path, length) == 0 && (path[length] == 0 || path[length] == '/')); } diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx index 3e5654a3c..38c6df71d 100644 --- a/src/db/update/Walk.cxx +++ b/src/db/update/Walk.cxx @@ -38,6 +38,7 @@ #include "fs/Charset.hxx" #include "storage/FileInfo.hxx" #include "util/Alloc.hxx" +#include "util/StringCompare.hxx" #include "util/UriUtil.hxx" #include "util/Error.hxx" #include "Log.hxx" @@ -435,7 +436,7 @@ UpdateWalk::DirectoryMakeUriParentChecked(Directory &root, const char *uri) while ((slash = strchr(name_utf8, '/')) != nullptr) { *slash = 0; - if (*name_utf8 == 0) + if (StringIsEmpty(name_utf8)) continue; directory = DirectoryMakeChildChecked(*directory, |