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
4ecf09f9
Commit
4ecf09f9
authored
Jan 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InotifyUpdate: use new/delete instead of GLib slices
parent
47a8369d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
InotifyUpdate.cxx
src/InotifyUpdate.cxx
+11
-9
No files found.
src/InotifyUpdate.cxx
View file @
4ecf09f9
...
...
@@ -55,6 +55,13 @@ struct WatchDirectory {
int
descriptor
;
GList
*
children
;
WatchDirectory
()
=
default
;
WatchDirectory
(
WatchDirectory
*
_parent
,
const
char
*
_name
,
int
_descriptor
)
:
parent
(
_parent
),
name
(
g_strdup
(
_name
)),
descriptor
(
_descriptor
),
children
(
nullptr
)
{}
};
static
InotifySource
*
inotify_source
;
...
...
@@ -112,7 +119,7 @@ remove_watch_directory(WatchDirectory *directory)
inotify_source
->
Remove
(
directory
->
descriptor
);
g_free
(
directory
->
name
);
g_slice_free
(
WatchDirectory
,
directory
)
;
delete
directory
;
}
static
char
*
...
...
@@ -169,7 +176,6 @@ recursive_watch_subdirectories(WatchDirectory *directory,
char
*
child_path_fs
;
struct
stat
st
;
int
ret
;
WatchDirectory
*
child
;
if
(
skip_path
(
ent
->
d_name
))
continue
;
...
...
@@ -198,18 +204,14 @@ recursive_watch_subdirectories(WatchDirectory *directory,
continue
;
}
child
=
tree_find_watch_directory
(
ret
);
WatchDirectory
*
child
=
tree_find_watch_directory
(
ret
);
if
(
child
!=
NULL
)
{
/* already being watched */
g_free
(
child_path_fs
);
continue
;
}
child
=
g_slice_new
(
WatchDirectory
);
child
->
parent
=
directory
;
child
->
name
=
g_strdup
(
ent
->
d_name
);
child
->
descriptor
=
ret
;
child
->
children
=
NULL
;
child
=
new
WatchDirectory
(
directory
,
ent
->
d_name
,
ret
);
directory
->
children
=
g_list_prepend
(
directory
->
children
,
child
);
...
...
@@ -356,7 +358,7 @@ mpd_inotify_finish(void)
g_list_free
(
directory
->
children
);
if
(
directory
!=
&
inotify_root
)
g_slice_free
(
WatchDirectory
,
directory
)
;
delete
directory
;
}
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