net/SocketAddress: use std::string_view::find() instead of std::memchr()
This commit is contained in:
parent
cbba22c947
commit
7c9b7fa311
|
@ -56,10 +56,9 @@ SocketAddress::GetLocalPath() const noexcept
|
||||||
return !raw.empty() &&
|
return !raw.empty() &&
|
||||||
/* must be an absolute path */
|
/* must be an absolute path */
|
||||||
raw.front() == '/' &&
|
raw.front() == '/' &&
|
||||||
/* must be null-terminated */
|
/* must be null-terminated and there must not be any
|
||||||
raw.back() == 0 &&
|
other null byte */
|
||||||
/* there must not be any other null byte */
|
raw.find('\0') == raw.size() - 1
|
||||||
std::memchr(raw.data(), 0, raw.size() - 1) == nullptr
|
|
||||||
? raw.data()
|
? raw.data()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue