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
c63bd323
Commit
c63bd323
authored
Oct 15, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringCompare: use std::memcmp()
parent
55db7105
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
StringCompare.cxx
src/util/StringCompare.cxx
+4
-4
No files found.
src/util/StringCompare.cxx
View file @
c63bd323
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include "StringCompare.hxx"
#include "StringCompare.hxx"
#include <
string.h
>
#include <
cstring
>
bool
bool
StringEndsWith
(
const
char
*
haystack
,
const
char
*
needle
)
noexcept
StringEndsWith
(
const
char
*
haystack
,
const
char
*
needle
)
noexcept
...
@@ -38,8 +38,8 @@ StringEndsWith(const char *haystack, const char *needle) noexcept
...
@@ -38,8 +38,8 @@ StringEndsWith(const char *haystack, const char *needle) noexcept
const
size_t
needle_length
=
StringLength
(
needle
);
const
size_t
needle_length
=
StringLength
(
needle
);
return
haystack_length
>=
needle_length
&&
return
haystack_length
>=
needle_length
&&
memcmp
(
haystack
+
haystack_length
-
needle_length
,
std
::
memcmp
(
haystack
+
haystack_length
-
needle_length
,
needle
,
needle_length
)
==
0
;
needle
,
needle_length
)
==
0
;
}
}
bool
bool
...
@@ -63,7 +63,7 @@ FindStringSuffix(const char *p, const char *suffix) noexcept
...
@@ -63,7 +63,7 @@ FindStringSuffix(const char *p, const char *suffix) noexcept
return
nullptr
;
return
nullptr
;
const
char
*
q
=
p
+
p_length
-
suffix_length
;
const
char
*
q
=
p
+
p_length
-
suffix_length
;
return
memcmp
(
q
,
suffix
,
suffix_length
)
==
0
return
std
::
memcmp
(
q
,
suffix
,
suffix_length
)
==
0
?
q
?
q
:
nullptr
;
:
nullptr
;
}
}
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