diff options
author | Max Kellermann <max@musicpd.org> | 2020-09-16 21:07:52 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-09-16 21:08:22 +0200 |
commit | e8213220e2a2bc8b691135053d360c47447c392e (patch) | |
tree | 7aedfd7dc60d49b7e40743bd17af9c214d61818f | |
parent | 83f9d2a9630b8122b94c9535acd7c0ad3bc7085e (diff) |
db/update/InotifyUpdate: split the WatchDirectory constructor
-rw-r--r-- | src/db/update/InotifyUpdate.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx index c513d8fab..eb0c2d305 100644 --- a/src/db/update/InotifyUpdate.cxx +++ b/src/db/update/InotifyUpdate.cxx @@ -55,9 +55,15 @@ struct WatchDirectory { std::forward_list<WatchDirectory> children; template<typename N> - WatchDirectory(WatchDirectory *_parent, N &&_name, + WatchDirectory(N &&_name, int _descriptor) - :parent(_parent), name(std::forward<N>(_name)), + :parent(nullptr), name(std::forward<N>(_name)), + descriptor(_descriptor) {} + + template<typename N> + WatchDirectory(WatchDirectory &_parent, N &&_name, + int _descriptor) + :parent(&_parent), name(std::forward<N>(_name)), descriptor(_descriptor) {} WatchDirectory(const WatchDirectory &) = delete; @@ -203,7 +209,7 @@ try { /* already being watched */ continue; - parent.children.emplace_front(&parent, + parent.children.emplace_front(parent, name_fs, ret); child = &parent.children.front(); @@ -310,7 +316,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update, return; } - inotify_root = new WatchDirectory(nullptr, path, descriptor); + inotify_root = new WatchDirectory(path, descriptor); tree_add_watch_directory(inotify_root); |