0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 14:08:56 +02:00

ircd::mods: Simplify is_module() stack.

This commit is contained in:
Jason Volk 2019-02-08 20:40:08 -08:00
parent 1b48dd7c68
commit b4f09d06ec

View file

@ -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;
}
//