Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f7d8e6c4
Commit
f7d8e6c4
authored
Jan 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InotifyUpdate: allocate the root dynamically
parent
4ecf09f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
InotifyUpdate.cxx
src/InotifyUpdate.cxx
+8
-10
No files found.
src/InotifyUpdate.cxx
View file @
f7d8e6c4
...
@@ -56,7 +56,6 @@ struct WatchDirectory {
...
@@ -56,7 +56,6 @@ struct WatchDirectory {
GList
*
children
;
GList
*
children
;
WatchDirectory
()
=
default
;
WatchDirectory
(
WatchDirectory
*
_parent
,
const
char
*
_name
,
WatchDirectory
(
WatchDirectory
*
_parent
,
const
char
*
_name
,
int
_descriptor
)
int
_descriptor
)
:
parent
(
_parent
),
name
(
g_strdup
(
_name
)),
:
parent
(
_parent
),
name
(
g_strdup
(
_name
)),
...
@@ -68,7 +67,7 @@ static InotifySource *inotify_source;
...
@@ -68,7 +67,7 @@ static InotifySource *inotify_source;
static
InotifyQueue
*
inotify_queue
;
static
InotifyQueue
*
inotify_queue
;
static
unsigned
inotify_max_depth
;
static
unsigned
inotify_max_depth
;
static
WatchDirectory
inotify_root
;
static
WatchDirectory
*
inotify_root
;
static
std
::
map
<
int
,
WatchDirectory
*>
inotify_directories
;
static
std
::
map
<
int
,
WatchDirectory
*>
inotify_directories
;
static
void
static
void
...
@@ -322,10 +321,8 @@ mpd_inotify_init(unsigned max_depth)
...
@@ -322,10 +321,8 @@ mpd_inotify_init(unsigned max_depth)
inotify_max_depth
=
max_depth
;
inotify_max_depth
=
max_depth
;
inotify_root
.
name
=
g_strdup
(
path
.
c_str
());
int
descriptor
=
inotify_source
->
Add
(
path
.
c_str
(),
IN_MASK
,
&
error
);
inotify_root
.
descriptor
=
inotify_source
->
Add
(
path
.
c_str
(),
if
(
descriptor
<
0
)
{
IN_MASK
,
&
error
);
if
(
inotify_root
.
descriptor
<
0
)
{
g_warning
(
"%s"
,
error
->
message
);
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
g_error_free
(
error
);
delete
inotify_source
;
delete
inotify_source
;
...
@@ -333,9 +330,11 @@ mpd_inotify_init(unsigned max_depth)
...
@@ -333,9 +330,11 @@ mpd_inotify_init(unsigned max_depth)
return
;
return
;
}
}
tree_add_watch_directory
(
&
inotify_root
);
inotify_root
=
new
WatchDirectory
(
nullptr
,
path
.
c_str
(),
descriptor
);
recursive_watch_subdirectories
(
&
inotify_root
,
path
.
c_str
(),
0
);
tree_add_watch_directory
(
inotify_root
);
recursive_watch_subdirectories
(
inotify_root
,
path
.
c_str
(),
0
);
inotify_queue
=
new
InotifyQueue
(
*
main_loop
);
inotify_queue
=
new
InotifyQueue
(
*
main_loop
);
...
@@ -357,8 +356,7 @@ mpd_inotify_finish(void)
...
@@ -357,8 +356,7 @@ mpd_inotify_finish(void)
g_free
(
directory
->
name
);
g_free
(
directory
->
name
);
g_list_free
(
directory
->
children
);
g_list_free
(
directory
->
children
);
if
(
directory
!=
&
inotify_root
)
delete
directory
;
delete
directory
;
}
}
inotify_directories
.
clear
();
inotify_directories
.
clear
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment