util/StringCompare: use std::memcmp()
This commit is contained in:
@@ -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
|
|||||||
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
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user