0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-04 21:08:57 +01:00

ircd:Ⓜ️🆔 Fail boolean validators faster on empty id.

This commit is contained in:
Jason Volk 2019-02-05 01:31:12 -08:00
parent 44d105b1ba
commit ccf9f87e2a

View file

@ -674,6 +674,9 @@ ircd::m::valid(const id::sigil &sigil,
const string_view &id)
noexcept try
{
if(empty(id))
return false;
validate(sigil, id);
return true;
}
@ -697,7 +700,10 @@ noexcept try
start + std::min(size(id), id::MAX_SIZE)
};
return id.at(0) == sigil && qi::parse(start, stop, test) && start == stop;
return !empty(id) &&
id.at(0) == sigil &&
qi::parse(start, stop, test) &&
start == stop;
}
catch(...)
{
@ -719,7 +725,9 @@ noexcept try
start + std::min(size(id), id::MAX_SIZE)
};
return id.at(0) == sigil && qi::parse(start, stop, test);
return !empty(id) &&
id.at(0) == sigil &&
qi::parse(start, stop, test);
}
catch(...)
{