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:
parent
44d105b1ba
commit
ccf9f87e2a
1 changed files with 10 additions and 2 deletions
12
ircd/m_id.cc
12
ircd/m_id.cc
|
@ -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(...)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue