aboutsummaryrefslogtreecommitdiffstats
path: root/src/InotifyUpdate.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 21:59:35 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 23:43:46 +0200
commitabfbd55305587306730d5419b8a3b09e6a43abcb (patch)
tree2a195220d79efe195f3beacb7dd3a226a3341ad6 /src/InotifyUpdate.cxx
parentb3611524f45c2a478f9decd6d22ecd1dbbbb64b9 (diff)
downloadmpd-abfbd55305587306730d5419b8a3b09e6a43abcb.tar.gz
mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.tar.xz
mpd-abfbd55305587306730d5419b8a3b09e6a43abcb.zip
fs/Path: rename to AllocatedPath
The new class Path only holds a string pointer without being responsible for allocation/deallocation. The FileSystem.hxx library accepts Path arguments instead of AllocatedPath, to avoid forcing callers to allocate another string object.
Diffstat (limited to 'src/InotifyUpdate.cxx')
-rw-r--r--src/InotifyUpdate.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/InotifyUpdate.cxx b/src/InotifyUpdate.cxx
index e1fe53b05..4a93f557b 100644
--- a/src/InotifyUpdate.cxx
+++ b/src/InotifyUpdate.cxx
@@ -24,7 +24,7 @@
#include "InotifyDomain.hxx"
#include "Mapper.hxx"
#include "Main.hxx"
-#include "fs/Path.hxx"
+#include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
@@ -50,7 +50,7 @@ enum {
struct WatchDirectory {
WatchDirectory *parent;
- Path name;
+ AllocatedPath name;
int descriptor;
@@ -129,17 +129,17 @@ remove_watch_directory(WatchDirectory *directory)
});
}
-static Path
+static AllocatedPath
watch_directory_get_uri_fs(const WatchDirectory *directory)
{
if (directory->parent == NULL)
- return Path::Null();
+ return AllocatedPath::Null();
- Path uri = watch_directory_get_uri_fs(directory->parent);
+ const auto uri = watch_directory_get_uri_fs(directory->parent);
if (uri.IsNull())
return directory->name;
- return Path::Build(uri, directory->name);
+ return AllocatedPath::Build(uri, directory->name);
}
/* we don't look at "." / ".." nor files with newlines in their name */
@@ -152,7 +152,7 @@ static bool skip_path(const char *path)
static void
recursive_watch_subdirectories(WatchDirectory *directory,
- const Path &path_fs, unsigned depth)
+ const AllocatedPath &path_fs, unsigned depth)
{
Error error;
DIR *dir;
@@ -181,7 +181,8 @@ recursive_watch_subdirectories(WatchDirectory *directory,
if (skip_path(ent->d_name))
continue;
- const Path child_path_fs = Path::Build(path_fs, ent->d_name);
+ const auto child_path_fs =
+ AllocatedPath::Build(path_fs, ent->d_name);
ret = StatFile(child_path_fs, st);
if (ret < 0) {
FormatErrno(inotify_domain,
@@ -209,7 +210,7 @@ recursive_watch_subdirectories(WatchDirectory *directory,
continue;
directory->children.emplace_front(directory,
- Path::FromFS(ent->d_name),
+ AllocatedPath::FromFS(ent->d_name),
ret);
child = &directory->children.front();
@@ -257,11 +258,11 @@ mpd_inotify_callback(int wd, unsigned mask,
(mask & IN_ISDIR) != 0) {
/* a sub directory was changed: register those in
inotify */
- const Path &root = mapper_get_music_directory_fs();
+ const auto &root = mapper_get_music_directory_fs();
- const Path path_fs = uri_fs.IsNull()
+ const auto path_fs = uri_fs.IsNull()
? root
- : Path::Build(root, uri_fs.c_str());
+ : AllocatedPath::Build(root, uri_fs.c_str());
recursive_watch_subdirectories(directory, path_fs,
watch_directory_depth(directory));
@@ -290,7 +291,7 @@ mpd_inotify_init(unsigned max_depth)
{
LogDebug(inotify_domain, "initializing inotify");
- const Path &path = mapper_get_music_directory_fs();
+ const auto &path = mapper_get_music_directory_fs();
if (path.IsNull()) {
LogDebug(inotify_domain, "no music directory configured");
return;