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
ba5c9b03
Commit
ba5c9b03
authored
Oct 08, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
directory: converted isRootDirectory() to an inline function
The function isRootDirectory() is tiny and can be converted to an inline function. Don't allow name==NULL.
parent
e1a4474a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
directory.c
src/directory.c
+5
-5
directory.h
src/directory.h
+5
-1
No files found.
src/directory.c
View file @
ba5c9b03
...
...
@@ -101,11 +101,6 @@ void directory_finish(void)
freeDirectory
(
music_root
);
}
int
isRootDirectory
(
const
char
*
name
)
{
return
(
!
name
||
name
[
0
]
==
'\0'
||
!
strcmp
(
name
,
"/"
));
}
struct
directory
*
directory_get_root
(
void
)
{
...
...
@@ -122,6 +117,8 @@ getSubDirectory(struct directory * directory, const char *name)
char
*
duplicated
;
char
*
locate
;
assert
(
name
!=
NULL
);
if
(
isRootDirectory
(
name
))
return
directory
;
...
...
@@ -148,6 +145,9 @@ getSubDirectory(struct directory * directory, const char *name)
struct
directory
*
getDirectory
(
const
char
*
name
)
{
if
(
name
==
NULL
)
return
music_root
;
return
getSubDirectory
(
music_root
,
name
);
}
...
...
src/directory.h
View file @
ba5c9b03
...
...
@@ -46,7 +46,11 @@ void directory_init(void);
void
directory_finish
(
void
);
int
isRootDirectory
(
const
char
*
name
);
static
inline
bool
isRootDirectory
(
const
char
*
name
)
{
return
name
[
0
]
==
0
||
(
name
[
0
]
==
'/'
&&
name
[
1
]
==
0
);
}
struct
directory
*
directory_get_root
(
void
);
...
...
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