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
6fd481df
Commit
6fd481df
authored
Oct 14, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mapper, ...: use memcmp() instead of strncmp() where appropriate
Micro-optimization.
parent
b915e433
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
11 deletions
+11
-11
Mapper.cxx
src/Mapper.cxx
+1
-1
OtherCommands.cxx
src/OtherCommands.cxx
+1
-1
QueueCommands.cxx
src/QueueCommands.cxx
+2
-2
CurlInputPlugin.cxx
src/input/CurlInputPlugin.cxx
+2
-2
HttpdClient.cxx
src/output/HttpdClient.cxx
+2
-2
SoundCloudPlaylistPlugin.cxx
src/playlist/SoundCloudPlaylistPlugin.cxx
+1
-1
UriUtil.cxx
src/util/UriUtil.cxx
+2
-2
No files found.
src/Mapper.cxx
View file @
6fd481df
...
...
@@ -252,7 +252,7 @@ std::string
map_fs_to_utf8
(
const
char
*
path_fs
)
{
if
(
!
music_dir_fs
.
IsNull
()
&&
strncmp
(
path_fs
,
music_dir_fs
.
c_str
(),
music_dir_fs_length
)
==
0
&&
memcmp
(
path_fs
,
music_dir_fs
.
data
(),
music_dir_fs_length
)
==
0
&&
G_IS_DIR_SEPARATOR
(
path_fs
[
music_dir_fs_length
]))
/* remove musicDir prefix */
path_fs
+=
music_dir_fs_length
+
1
;
...
...
src/OtherCommands.cxx
View file @
6fd481df
...
...
@@ -114,7 +114,7 @@ handle_lsinfo(Client *client, int argc, char *argv[])
/* default is root directory */
uri
=
""
;
if
(
strn
cmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
if
(
mem
cmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
/* print information about an arbitrary local file */
const
char
*
path_utf8
=
uri
+
7
;
const
Path
path_fs
=
Path
::
FromUTF8
(
path_utf8
);
...
...
src/QueueCommands.cxx
View file @
6fd481df
...
...
@@ -43,7 +43,7 @@ handle_add(Client *client, gcc_unused int argc, char *argv[])
char
*
uri
=
argv
[
1
];
enum
playlist_result
result
;
if
(
strn
cmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
if
(
mem
cmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
const
char
*
path_utf8
=
uri
+
7
;
const
Path
path_fs
=
Path
::
FromUTF8
(
path_utf8
);
...
...
@@ -86,7 +86,7 @@ handle_addid(Client *client, int argc, char *argv[])
unsigned
added_id
;
enum
playlist_result
result
;
if
(
strn
cmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
if
(
mem
cmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
const
char
*
path_utf8
=
uri
+
7
;
const
Path
path_fs
=
Path
::
FromUTF8
(
path_utf8
);
...
...
src/input/CurlInputPlugin.cxx
View file @
6fd481df
...
...
@@ -1084,8 +1084,8 @@ static struct input_stream *
input_curl_open
(
const
char
*
url
,
Mutex
&
mutex
,
Cond
&
cond
,
Error
&
error
)
{
if
(
(
strncmp
(
url
,
"http://"
,
7
)
!=
0
)
&&
(
strncmp
(
url
,
"https://"
,
8
)
!=
0
)
)
if
(
memcmp
(
url
,
"http://"
,
7
)
!=
0
&&
memcmp
(
url
,
"https://"
,
8
)
!=
0
)
return
NULL
;
struct
input_curl
*
c
=
new
input_curl
(
url
,
mutex
,
cond
);
...
...
src/output/HttpdClient.cxx
View file @
6fd481df
...
...
@@ -78,7 +78,7 @@ HttpdClient::HandleLine(const char *line)
assert
(
state
!=
RESPONSE
);
if
(
state
==
REQUEST
)
{
if
(
strn
cmp
(
line
,
"GET /"
,
5
)
!=
0
)
{
if
(
mem
cmp
(
line
,
"GET /"
,
5
)
!=
0
)
{
/* only GET is supported */
LogWarning
(
httpd_output_domain
,
"malformed request line from client"
);
...
...
@@ -86,7 +86,7 @@ HttpdClient::HandleLine(const char *line)
}
line
=
strchr
(
line
+
5
,
' '
);
if
(
line
==
nullptr
||
strn
cmp
(
line
+
1
,
"HTTP/"
,
5
)
!=
0
)
{
if
(
line
==
nullptr
||
mem
cmp
(
line
+
1
,
"HTTP/"
,
5
)
!=
0
)
{
/* HTTP/0.9 without request headers */
BeginResponse
();
return
true
;
...
...
src/playlist/SoundCloudPlaylistPlugin.cxx
View file @
6fd481df
...
...
@@ -175,7 +175,7 @@ static int handle_mapkey(void *ctx, const unsigned char* stringval,
data
->
key
=
Other
;
for
(
i
=
0
;
i
<
Other
;
++
i
)
{
if
(
strn
cmp
((
const
char
*
)
stringval
,
key_str
[
i
],
stringlen
)
==
0
)
{
if
(
mem
cmp
((
const
char
*
)
stringval
,
key_str
[
i
],
stringlen
)
==
0
)
{
data
->
key
=
i
;
break
;
}
...
...
src/util/UriUtil.cxx
View file @
6fd481df
...
...
@@ -86,9 +86,9 @@ uri_remove_auth(const char *uri)
const
char
*
auth
,
*
slash
,
*
at
;
char
*
p
;
if
(
strn
cmp
(
uri
,
"http://"
,
7
)
==
0
)
if
(
mem
cmp
(
uri
,
"http://"
,
7
)
==
0
)
auth
=
uri
+
7
;
else
if
(
strn
cmp
(
uri
,
"https://"
,
8
)
==
0
)
else
if
(
mem
cmp
(
uri
,
"https://"
,
8
)
==
0
)
auth
=
uri
+
8
;
else
/* unrecognized URI */
...
...
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