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
e79aacf1
Commit
e79aacf1
authored
Oct 08, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
directory: added directory_is_empty()
directory_is_empty() is a tiny inline function which determine if a directory has any child objects (sub directories or songs).
parent
7b9bed83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
directory.c
src/directory.c
+1
-1
directory.h
src/directory.h
+8
-0
No files found.
src/directory.c
View file @
e79aacf1
...
...
@@ -89,7 +89,7 @@ static void deleteEmptyDirectoriesInDirectory(Directory * directory)
for
(
i
=
dv
->
nr
;
--
i
>=
0
;
)
{
deleteEmptyDirectoriesInDirectory
(
dv
->
base
[
i
]);
if
(
!
dv
->
base
[
i
]
->
children
.
nr
&&
!
dv
->
base
[
i
]
->
songs
.
nr
)
if
(
directory_is_empty
(
dv
->
base
[
i
])
)
dirvec_delete
(
dv
,
dv
->
base
[
i
]);
}
if
(
!
dv
->
nr
)
...
...
src/directory.h
View file @
e79aacf1
...
...
@@ -23,6 +23,8 @@
#include "songvec.h"
#include "list.h"
#include <stdbool.h>
struct
dirvec
{
struct
_Directory
**
base
;
size_t
nr
;
...
...
@@ -53,6 +55,12 @@ newDirectory(const char *dirname, Directory * parent);
void
freeDirectory
(
Directory
*
directory
);
static
inline
bool
directory_is_empty
(
Directory
*
directory
)
{
return
directory
->
children
.
nr
==
0
&&
directory
->
songs
.
nr
==
0
;
}
Directory
*
getDirectory
(
const
char
*
name
);
...
...
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