util/StringCompare: use std::memcmp()
This commit is contained in:
parent
55db7105c5
commit
c63bd323ce
@ -29,7 +29,7 @@
|
||||
|
||||
#include "StringCompare.hxx"
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
bool
|
||||
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);
|
||||
|
||||
return haystack_length >= needle_length &&
|
||||
memcmp(haystack + haystack_length - needle_length,
|
||||
needle, needle_length) == 0;
|
||||
std::memcmp(haystack + haystack_length - needle_length,
|
||||
needle, needle_length) == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -63,7 +63,7 @@ FindStringSuffix(const char *p, const char *suffix) noexcept
|
||||
return nullptr;
|
||||
|
||||
const char *q = p + p_length - suffix_length;
|
||||
return memcmp(q, suffix, suffix_length) == 0
|
||||
return std::memcmp(q, suffix, suffix_length) == 0
|
||||
? q
|
||||
: nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user