array conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2021-11-13 17:27:07 -08:00
parent e08c85ae2d
commit 9bcd425a85
5 changed files with 12 additions and 10 deletions

View File

@@ -31,6 +31,7 @@
#include "ASCII.hxx"
#include "SplitString.hxx"
#include <array>
#include <cassert>
#include <cstring>
@@ -73,7 +74,7 @@ gcc_pure
static const char *
SkipUriScheme(const char *uri) noexcept
{
static const char *const schemes[] = {
static constexpr auto schemes = std::array {
"http://", "https://",
"ftp://",
"smb://",
@@ -100,7 +101,7 @@ uri_remove_auth(const char *uri) noexcept
if (slash == nullptr)
slash = auth + strlen(auth);
const char *at = (const char *)std::memchr(auth, '@', slash - auth);
auto at = (const char *)std::memchr(auth, '@', slash - auth);
if (at == nullptr)
/* no auth info present, do nothing */
return std::string();