From b4f09d06ec4e3d3e197a7af3a0ffed8d598f8c12 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 8 Feb 2019 20:40:08 -0800 Subject: [PATCH] ircd::mods: Simplify is_module() stack. --- ircd/mods.cc | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/ircd/mods.cc b/ircd/mods.cc index d9fd43344..718190842 100644 --- a/ircd/mods.cc +++ b/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; } //