mirror of
https://github.com/matrix-construct/construct
synced 2024-09-29 20:28:52 +02:00
ircd::mods: Simplify is_module() stack.
This commit is contained in:
parent
1b48dd7c68
commit
b4f09d06ec
1 changed files with 15 additions and 18 deletions
33
ircd/mods.cc
33
ircd/mods.cc
|
@ -474,6 +474,13 @@ ircd::mods::search(const string_view &name,
|
|||
// is_module
|
||||
//
|
||||
|
||||
bool
|
||||
ircd::mods::is_module(const string_view &path)
|
||||
{
|
||||
std::string why;
|
||||
return is_module(path, why);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::mods::is_module(const string_view &path,
|
||||
std::nothrow_t)
|
||||
|
@ -489,18 +496,6 @@ catch(const std::exception &e)
|
|||
bool
|
||||
ircd::mods::is_module(const string_view &path,
|
||||
std::string &why)
|
||||
try
|
||||
{
|
||||
return is_module(path);
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
why = e.what();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::mods::is_module(const string_view &path)
|
||||
{
|
||||
static const auto &header_name
|
||||
{
|
||||
|
@ -517,13 +512,15 @@ ircd::mods::is_module(const string_view &path)
|
|||
std::find(begin(syms), end(syms), header_name)
|
||||
};
|
||||
|
||||
if(it == end(syms))
|
||||
throw error
|
||||
{
|
||||
"`%s': has no MAPI header (%s)", path, header_name
|
||||
};
|
||||
if(it != end(syms))
|
||||
return true;
|
||||
|
||||
return true;
|
||||
why = fmt::snstringf
|
||||
{
|
||||
256, "`%s': has no MAPI header (%s)", path, header_name
|
||||
};
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue