Fix minor bug and style

This commit is contained in:
alesapin 2019-06-24 16:04:20 +03:00
parent 5b378a3f01
commit c6ece40f3c

View File

@ -8,11 +8,12 @@
namespace DB
{
namespace {
namespace
{
inline StringRef buildFound(const Pos & pos, const Pos & dot_pos, const Pos & start_of_host)
{
if (!dot_pos || start_of_host >= pos)
if (!dot_pos || start_of_host >= pos || pos - dot_pos == 1)
return StringRef{};
auto after_dot = *(dot_pos + 1);
@ -30,10 +31,6 @@ inline StringRef getURLHost(const char * data, size_t size)
Pos pos = data;
Pos end = data + size;
if (*(end - 1) == '.')
return StringRef{};
Pos slash_pos = find_first_symbols<'/'>(pos, end);
if (slash_pos != end)
pos = slash_pos;
@ -56,7 +53,7 @@ inline StringRef getURLHost(const char * data, size_t size)
Pos dot_pos = nullptr;
for (; pos < end; ++pos)
{
switch(*pos)
switch (*pos)
{
case '.':
dot_pos = pos;