summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-09-16 20:57:37 +0200
committerMax Kellermann <max@musicpd.org>2020-09-16 20:57:46 +0200
commite907ff43aec3690858d0a9174ff79e884edd7b89 (patch)
treeda93567ea661d19d2a73430fa8c8bfdd0a62badd
parentb18fc3a8d0ae115d6f37d765925aaf441646c76c (diff)
command/file, storage/{nfs,smbclient}: use PathTraitsFS::IsSpecialFilename()
Eliminate some duplicate code.
-rw-r--r--src/command/FileCommands.cxx4
-rw-r--r--src/storage/plugins/NfsStorage.cxx4
-rw-r--r--src/storage/plugins/SmbclientStorage.cxx6
3 files changed, 4 insertions, 10 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx
index 448da2caf..29685713d 100644
--- a/src/command/FileCommands.cxx
+++ b/src/command/FileCommands.cxx
@@ -50,9 +50,7 @@ gcc_pure
static bool
SkipNameFS(PathTraitsFS::const_pointer_type name_fs) noexcept
{
- return name_fs[0] == '.' &&
- (name_fs[1] == 0 ||
- (name_fs[1] == '.' && name_fs[2] == 0));
+ return PathTraitsFS::IsSpecialFilename(name_fs);
}
gcc_pure
diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx
index e485fd8e4..e7d125a81 100644
--- a/src/storage/plugins/NfsStorage.cxx
+++ b/src/storage/plugins/NfsStorage.cxx
@@ -307,9 +307,7 @@ gcc_pure
static bool
SkipNameFS(PathTraitsFS::const_pointer_type name) noexcept
{
- return name[0] == '.' &&
- (name[1] == 0 ||
- (name[1] == '.' && name[2] == 0));
+ return PathTraitsFS::IsSpecialFilename(name);
}
static void
diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx
index 0324bf219..ff6262f58 100644
--- a/src/storage/plugins/SmbclientStorage.cxx
+++ b/src/storage/plugins/SmbclientStorage.cxx
@@ -144,11 +144,9 @@ SmbclientStorage::OpenDirectory(const char *uri_utf8)
gcc_pure
static bool
-SkipNameFS(const char *name) noexcept
+SkipNameFS(PathTraitsFS::const_pointer_type name) noexcept
{
- return name[0] == '.' &&
- (name[1] == 0 ||
- (name[1] == '.' && name[2] == 0));
+ return PathTraitsFS::IsSpecialFilename(name);
}
SmbclientDirectoryReader::~SmbclientDirectoryReader()