summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2020-09-16 20:48:27 +0200
committerMax Kellermann <max@musicpd.org>2020-09-16 20:59:41 +0200
commitbf97ebf89ff442de455b1d17d9e473f6abcc7be3 (patch)
tree34c6f4a3becfba6b2f7f796264f2945b2f846a6c
parent5b22d27cbb00d9be5ff9393b26d55577194a8079 (diff)
db/update/InotifyUpdate: convert pointer to reference
-rw-r--r--src/db/update/InotifyUpdate.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx
index cf917b7cb..de0e4355e 100644
--- a/src/db/update/InotifyUpdate.cxx
+++ b/src/db/update/InotifyUpdate.cxx
@@ -152,13 +152,12 @@ static bool skip_path(const char *path)
}
static void
-recursive_watch_subdirectories(WatchDirectory *directory,
+recursive_watch_subdirectories(WatchDirectory &parent,
const AllocatedPath &path_fs, unsigned depth)
{
DIR *dir;
struct dirent *ent;
- assert(directory != nullptr);
assert(depth <= inotify_max_depth);
assert(!path_fs.IsNull());
@@ -209,14 +208,14 @@ recursive_watch_subdirectories(WatchDirectory *directory,
/* already being watched */
continue;
- directory->children.emplace_front(directory,
- name_fs,
- ret);
- child = &directory->children.front();
+ parent.children.emplace_front(&parent,
+ name_fs,
+ ret);
+ child = &parent.children.front();
tree_add_watch_directory(child);
- recursive_watch_subdirectories(child, child_path_fs, depth);
+ recursive_watch_subdirectories(*child, child_path_fs, depth);
}
closedir(dir);
@@ -261,7 +260,7 @@ mpd_inotify_callback(int wd, unsigned mask,
? root
: (root / uri_fs);
- recursive_watch_subdirectories(directory, path_fs,
+ recursive_watch_subdirectories(*directory, path_fs,
directory->GetDepth());
}
@@ -320,7 +319,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
tree_add_watch_directory(inotify_root);
- recursive_watch_subdirectories(inotify_root, path, 0);
+ recursive_watch_subdirectories(*inotify_root, path, 0);
inotify_queue = new InotifyQueue(loop, update);