db/update/InotifyUpdate: split the WatchDirectory constructor
This commit is contained in:
parent
83f9d2a963
commit
e8213220e2
@ -55,9 +55,15 @@ struct WatchDirectory {
|
|||||||
std::forward_list<WatchDirectory> children;
|
std::forward_list<WatchDirectory> children;
|
||||||
|
|
||||||
template<typename N>
|
template<typename N>
|
||||||
WatchDirectory(WatchDirectory *_parent, N &&_name,
|
WatchDirectory(N &&_name,
|
||||||
int _descriptor)
|
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) {}
|
descriptor(_descriptor) {}
|
||||||
|
|
||||||
WatchDirectory(const WatchDirectory &) = delete;
|
WatchDirectory(const WatchDirectory &) = delete;
|
||||||
@ -203,7 +209,7 @@ try {
|
|||||||
/* already being watched */
|
/* already being watched */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
parent.children.emplace_front(&parent,
|
parent.children.emplace_front(parent,
|
||||||
name_fs,
|
name_fs,
|
||||||
ret);
|
ret);
|
||||||
child = &parent.children.front();
|
child = &parent.children.front();
|
||||||
@ -310,7 +316,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inotify_root = new WatchDirectory(nullptr, path, descriptor);
|
inotify_root = new WatchDirectory(path, descriptor);
|
||||||
|
|
||||||
tree_add_watch_directory(inotify_root);
|
tree_add_watch_directory(inotify_root);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user