net/SocketAddress: use std::string_view::find() instead of std::memchr()

This commit is contained in:
Max Kellermann 2024-04-29 16:58:04 +02:00 committed by Max Kellermann
parent cbba22c947
commit 7c9b7fa311
1 changed files with 3 additions and 4 deletions

View File

@ -56,10 +56,9 @@ SocketAddress::GetLocalPath() const noexcept
return !raw.empty() &&
/* must be an absolute path */
raw.front() == '/' &&
/* must be null-terminated */
raw.back() == 0 &&
/* there must not be any other null byte */
std::memchr(raw.data(), 0, raw.size() - 1) == nullptr
/* must be null-terminated and there must not be any
other null byte */
raw.find('\0') == raw.size() - 1
? raw.data()
: nullptr;
}