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
e85b9960
Commit
e85b9960
authored
Aug 20, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util/StringCompare: use StringAPI.hxx
parent
75c836fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
StringCompare.cxx
src/util/StringCompare.cxx
+4
-4
StringCompare.hxx
src/util/StringCompare.hxx
+2
-1
No files found.
src/util/StringCompare.cxx
View file @
e85b9960
...
...
@@ -32,8 +32,8 @@
bool
StringEndsWith
(
const
char
*
haystack
,
const
char
*
needle
)
noexcept
{
const
size_t
haystack_length
=
strlen
(
haystack
);
const
size_t
needle_length
=
strlen
(
needle
);
const
size_t
haystack_length
=
StringLength
(
haystack
);
const
size_t
needle_length
=
StringLength
(
needle
);
return
haystack_length
>=
needle_length
&&
memcmp
(
haystack
+
haystack_length
-
needle_length
,
...
...
@@ -43,8 +43,8 @@ StringEndsWith(const char *haystack, const char *needle) noexcept
const
char
*
FindStringSuffix
(
const
char
*
p
,
const
char
*
suffix
)
noexcept
{
const
size_t
p_length
=
strlen
(
p
);
const
size_t
suffix_length
=
strlen
(
suffix
);
const
size_t
p_length
=
StringLength
(
p
);
const
size_t
suffix_length
=
StringLength
(
suffix
);
if
(
p_length
<
suffix_length
)
return
nullptr
;
...
...
src/util/StringCompare.hxx
View file @
e85b9960
...
...
@@ -31,6 +31,7 @@
#define STRING_COMPARE_HXX
#include "StringView.hxx"
#include "StringAPI.hxx"
#include "Compiler.h"
#ifdef _UNICODE
...
...
@@ -47,7 +48,7 @@ gcc_pure gcc_nonnull_all
static
inline
bool
StringStartsWith
(
const
char
*
haystack
,
StringView
needle
)
noexcept
{
return
strncmp
(
haystack
,
needle
.
data
,
needle
.
size
)
==
0
;
return
StringIsEqual
(
haystack
,
needle
.
data
,
needle
.
size
)
;
}
gcc_pure
...
...
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