db/update/InotifyUpdate: convert pointer to reference

This commit is contained in:
Max Kellermann 2020-09-16 20:48:27 +02:00
parent 5b22d27cbb
commit bf97ebf89f

View File

@ -152,13 +152,12 @@ static bool skip_path(const char *path)
} }
static void static void
recursive_watch_subdirectories(WatchDirectory *directory, recursive_watch_subdirectories(WatchDirectory &parent,
const AllocatedPath &path_fs, unsigned depth) const AllocatedPath &path_fs, unsigned depth)
{ {
DIR *dir; DIR *dir;
struct dirent *ent; struct dirent *ent;
assert(directory != nullptr);
assert(depth <= inotify_max_depth); assert(depth <= inotify_max_depth);
assert(!path_fs.IsNull()); assert(!path_fs.IsNull());
@ -209,14 +208,14 @@ recursive_watch_subdirectories(WatchDirectory *directory,
/* already being watched */ /* already being watched */
continue; continue;
directory->children.emplace_front(directory, parent.children.emplace_front(&parent,
name_fs, name_fs,
ret); ret);
child = &directory->children.front(); child = &parent.children.front();
tree_add_watch_directory(child); tree_add_watch_directory(child);
recursive_watch_subdirectories(child, child_path_fs, depth); recursive_watch_subdirectories(*child, child_path_fs, depth);
} }
closedir(dir); closedir(dir);
@ -261,7 +260,7 @@ mpd_inotify_callback(int wd, unsigned mask,
? root ? root
: (root / uri_fs); : (root / uri_fs);
recursive_watch_subdirectories(directory, path_fs, recursive_watch_subdirectories(*directory, path_fs,
directory->GetDepth()); directory->GetDepth());
} }
@ -320,7 +319,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
tree_add_watch_directory(inotify_root); 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); inotify_queue = new InotifyQueue(loop, update);