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/storage | |
parent | 42f5ecd4a116c96d30bf407859dadaa9a053ea39 (diff) |
util/StringCompare: add StringIsEmpty()
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/CompositeStorage.cxx | 3 | ||||
-rw-r--r-- | src/storage/plugins/LocalStorage.cxx | 7 | ||||
-rw-r--r-- | src/storage/plugins/NfsStorage.cxx | 5 | ||||
-rw-r--r-- | src/storage/plugins/SmbclientStorage.cxx | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/src/storage/CompositeStorage.cxx b/src/storage/CompositeStorage.cxx index 10a478c0d..eb3a9546f 100644 --- a/src/storage/CompositeStorage.cxx +++ b/src/storage/CompositeStorage.cxx @@ -23,6 +23,7 @@ #include "fs/AllocatedPath.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" +#include "util/StringCompare.hxx" #include <set> @@ -164,7 +165,7 @@ CompositeStorage::Directory::Unmount() bool CompositeStorage::Directory::Unmount(const char *uri) { - if (*uri == 0) + if (StringIsEmpty(uri)) return Unmount(); const std::string name = NextSegment(uri); diff --git a/src/storage/plugins/LocalStorage.cxx b/src/storage/plugins/LocalStorage.cxx index 83903ec81..b35161dd1 100644 --- a/src/storage/plugins/LocalStorage.cxx +++ b/src/storage/plugins/LocalStorage.cxx @@ -22,10 +22,11 @@ #include "storage/StoragePlugin.hxx" #include "storage/StorageInterface.hxx" #include "storage/FileInfo.hxx" -#include "util/Error.hxx" #include "fs/FileInfo.hxx" #include "fs/AllocatedPath.hxx" #include "fs/DirectoryReader.hxx" +#include "util/Error.hxx" +#include "util/StringCompare.hxx" #include <string> @@ -108,7 +109,7 @@ LocalStorage::MapUTF8(const char *uri_utf8) const { assert(uri_utf8 != nullptr); - if (*uri_utf8 == 0) + if (StringIsEmpty(uri_utf8)) return base_utf8; return PathTraitsUTF8::Build(base_utf8.c_str(), uri_utf8); @@ -119,7 +120,7 @@ LocalStorage::MapFS(const char *uri_utf8, Error &error) const { assert(uri_utf8 != nullptr); - if (*uri_utf8 == 0) + if (StringIsEmpty(uri_utf8)) return base_fs; AllocatedPath path_fs = AllocatedPath::FromUTF8(uri_utf8, error); diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index fc4fd5c07..517e0c93a 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -30,13 +30,14 @@ #include "lib/nfs/Connection.hxx" #include "lib/nfs/Glue.hxx" #include "fs/AllocatedPath.hxx" -#include "util/Error.hxx" #include "thread/Mutex.hxx" #include "thread/Cond.hxx" #include "event/Loop.hxx" #include "event/Call.hxx" #include "event/DeferredMonitor.hxx" #include "event/TimeoutMonitor.hxx" +#include "util/Error.hxx" +#include "util/StringCompare.hxx" extern "C" { #include <nfsc/libnfs.h> @@ -232,7 +233,7 @@ NfsStorage::MapUTF8(const char *uri_utf8) const { assert(uri_utf8 != nullptr); - if (*uri_utf8 == 0) + if (StringIsEmpty(uri_utf8)) return base; return PathTraitsUTF8::Build(base.c_str(), uri_utf8); diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx index 84b212cd1..a3d392a8a 100644 --- a/src/storage/plugins/SmbclientStorage.cxx +++ b/src/storage/plugins/SmbclientStorage.cxx @@ -25,8 +25,9 @@ #include "lib/smbclient/Init.hxx" #include "lib/smbclient/Mutex.hxx" #include "fs/Traits.hxx" -#include "util/Error.hxx" #include "thread/Mutex.hxx" +#include "util/Error.hxx" +#include "util/StringCompare.hxx" #include <libsmbclient.h> @@ -80,7 +81,7 @@ SmbclientStorage::MapUTF8(const char *uri_utf8) const { assert(uri_utf8 != nullptr); - if (*uri_utf8 == 0) + if (StringIsEmpty(uri_utf8)) return base; return PathTraitsUTF8::Build(base.c_str(), uri_utf8); |