util/StringCompare: use std::memcmp()

This commit is contained in:
Max Kellermann 2020-10-15 12:48:06 +02:00
parent 55db7105c5
commit c63bd323ce

View File

@ -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;
}