mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd: Minor cleanup.
This commit is contained in:
parent
2e7dd1e5ad
commit
3a31c62681
9 changed files with 16 additions and 48 deletions
|
@ -24,7 +24,7 @@
|
|||
#include "lgetopt.h"
|
||||
#include "charybdis.h"
|
||||
|
||||
namespace path = ircd::path;
|
||||
namespace fs = ircd::fs;
|
||||
|
||||
static void sigfd_handler(const boost::system::error_code &, int);
|
||||
static bool startup_checks();
|
||||
|
@ -95,7 +95,7 @@ try
|
|||
return 0;
|
||||
}
|
||||
|
||||
const std::string confpath(configfile?: path::get(path::IRCD_CONF));
|
||||
const std::string confpath(configfile?: fs::get(fs::IRCD_CONF));
|
||||
ircd::init(*ios, confpath);
|
||||
|
||||
sigs.add(SIGHUP);
|
||||
|
@ -166,7 +166,7 @@ try
|
|||
throw ircd::error("Don't run ircd as root!!!");
|
||||
#endif
|
||||
|
||||
path::chdir(path::get(path::PREFIX));
|
||||
fs::chdir(fs::get(fs::PREFIX));
|
||||
return true;
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
|
|
|
@ -44,17 +44,10 @@ void interrupt(ctx &); // Interrupt the context for te
|
|||
bool notify(ctx &); // Queue context switch (only library ppl need this)
|
||||
void yield(ctx &); // Direct context switch (only library ppl need this)
|
||||
|
||||
} // namespace ctx
|
||||
} // namespace ircd
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// "this_context" interface relevant to the currently running context
|
||||
//
|
||||
|
||||
namespace ircd {
|
||||
namespace ctx {
|
||||
|
||||
extern __thread struct ctx *current; // Always set to the currently running context or null
|
||||
|
||||
ctx &cur(); // Convenience for *current (try to use this instead)
|
||||
|
|
|
@ -107,13 +107,13 @@ struct name \
|
|||
:parent \
|
||||
{ \
|
||||
template<class... args> \
|
||||
name(const char *const fmt = " ", args&&... ap) noexcept \
|
||||
name(const char *const &fmt = " ", args&&... ap) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
generate(#name, fmt, va_rtti{std::forward<args>(ap)...}); \
|
||||
} \
|
||||
\
|
||||
name(const generate_skip_t) noexcept \
|
||||
name(generate_skip_t) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
} \
|
||||
|
@ -124,13 +124,13 @@ struct name \
|
|||
:parent \
|
||||
{ \
|
||||
template<class... args> \
|
||||
name(const char *const fmt = " ", args&&... ap) noexcept \
|
||||
:parent{generate_skip_t} \
|
||||
name(const char *const &fmt = " ", args&&... ap) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
generate(fmt, va_rtti{std::forward<args>(ap)...}); \
|
||||
} \
|
||||
\
|
||||
name(const generate_skip_t = {}) noexcept \
|
||||
name(generate_skip_t = {}) noexcept \
|
||||
:parent{generate_skip} \
|
||||
{ \
|
||||
} \
|
||||
|
|
|
@ -132,13 +132,6 @@ std::forward_list<std::string> available();
|
|||
bool available(const std::string &name);
|
||||
bool loaded(const std::string &name);
|
||||
|
||||
// Initialization and destruction singleton held by ircd::main()
|
||||
struct init
|
||||
{
|
||||
init();
|
||||
~init() noexcept;
|
||||
};
|
||||
|
||||
} // namespace mods
|
||||
} // namespace ircd
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ grammar<it, top>::grammar(qi::rule<it, top> &top_rule)
|
|||
{
|
||||
}
|
||||
|
||||
// Instantiate the input grammar to parse a uint8_t* buffer into an rfc1459::line object.
|
||||
// Instantiate the input grammar to parse a const char* buffer into an rfc1459::line object.
|
||||
// The top rule is inherited and then specified as grammar::line, which is compatible
|
||||
// with an rfc1459::line object.
|
||||
//
|
||||
|
@ -207,7 +207,7 @@ struct head
|
|||
}
|
||||
extern const head;
|
||||
|
||||
// Instantiate the input grammar to parse a uint8_t* buffer into an rfc1459::tape object.
|
||||
// Instantiate the input grammar to parse a const char* buffer into an rfc1459::tape object.
|
||||
// The top rule is now grammar::tape and the target object is an rfc1459::tape deque.
|
||||
//
|
||||
struct capstan
|
||||
|
|
|
@ -39,8 +39,8 @@ IRCD_EXCEPTION(error, nxdomain)
|
|||
|
||||
extern asio::ssl::context sslv23_client;
|
||||
|
||||
std::string string(const ip::address &);
|
||||
ip::address address(const ip::tcp::endpoint &);
|
||||
std::string hostaddr(const ip::address &);
|
||||
std::string hostaddr(const ip::tcp::endpoint &);
|
||||
uint16_t port(const ip::tcp::endpoint &);
|
||||
|
||||
|
@ -356,11 +356,11 @@ ircd::port(const ip::tcp::endpoint &ep)
|
|||
inline std::string
|
||||
ircd::hostaddr(const ip::tcp::endpoint &ep)
|
||||
{
|
||||
return hostaddr(address(ep));
|
||||
return string(address(ep));
|
||||
}
|
||||
|
||||
inline std::string
|
||||
ircd::hostaddr(const ip::address &addr)
|
||||
ircd::string(const ip::address &addr)
|
||||
{
|
||||
return addr.to_string();
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ ircd::remote_addr(const client &client)
|
|||
ircd::http::response::write_closure
|
||||
ircd::write_closure(client &client)
|
||||
{
|
||||
// returns a function that can be called to send an iovector of data to a client
|
||||
return [&client](const const_buffers &iov)
|
||||
{
|
||||
write(*client.sock, iov);
|
||||
|
@ -177,6 +178,7 @@ ircd::read_closure(client &client)
|
|||
}
|
||||
});
|
||||
|
||||
// Returns a function the parser can call when it wants more data
|
||||
return [&client](char *&start, char *const &stop)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -656,11 +656,6 @@ fmt::generate_string(char *&out,
|
|||
const char *const &str{*static_cast<const char *const *const>(ptr)};
|
||||
return karma::generate(out, gen, string_view{str});
|
||||
}
|
||||
else if(type == typeid(std::exception))
|
||||
{
|
||||
const auto &e{*static_cast<const std::exception *>(ptr)};
|
||||
return karma::generate(out, gen, string_view{e.what()});
|
||||
}
|
||||
|
||||
// This for string literals which have unique array types depending on their size.
|
||||
// There is no reasonable way to match them. The best that can be hoped for is the
|
||||
|
|
17
ircd/mods.cc
17
ircd/mods.cc
|
@ -92,26 +92,11 @@ struct log::log log
|
|||
} // namespace mods
|
||||
} // namespace ircd
|
||||
|
||||
ircd::mods::init::init()
|
||||
{
|
||||
}
|
||||
|
||||
ircd::mods::init::~init()
|
||||
noexcept
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// module
|
||||
//
|
||||
|
||||
namespace ircd {
|
||||
namespace mods {
|
||||
|
||||
} // namespace mods
|
||||
} // namespace ircd
|
||||
|
||||
ircd::mods::module::module(const std::string &name)
|
||||
try
|
||||
:std::shared_ptr<mod>{[&name]
|
||||
|
@ -484,7 +469,7 @@ namespace mods {
|
|||
|
||||
const filesystem::path modroot
|
||||
{
|
||||
ircd::path::get(ircd::path::MODULES)
|
||||
ircd::fs::get(ircd::fs::MODULES)
|
||||
};
|
||||
|
||||
struct paths paths;
|
||||
|
|
Loading…
Reference in a new issue