0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd: Convert various exception format string arguments to string_view.

This commit is contained in:
Jason Volk 2018-12-10 13:08:35 -08:00
parent 19f1929b1f
commit 97b3003280
5 changed files with 18 additions and 18 deletions

View file

@ -91,8 +91,8 @@ struct ircd::exception
char buf[BUFSIZE]; char buf[BUFSIZE];
ssize_t generate(const char *const &name, const char *const &fmt, const va_rtti &ap) noexcept; ssize_t generate(const char *const &name, const string_view &fmt, const va_rtti &ap) noexcept;
ssize_t generate(const char *const &fmt, const va_rtti &ap) noexcept; ssize_t generate(const string_view &fmt, const va_rtti &ap) noexcept;
public: public:
const char *what() const noexcept final override const char *what() const noexcept final override
@ -162,7 +162,7 @@ struct name \
:parent \ :parent \
{ \ { \
template<class... args> \ template<class... args> \
name(const char *const &fmt = " ", args&&... ap) noexcept \ name(const string_view &fmt = " ", args&&... ap) noexcept \
:parent{generate_skip} \ :parent{generate_skip} \
{ \ { \
generate(#name, fmt, ircd::va_rtti{std::forward<args>(ap)...}); \ generate(#name, fmt, ircd::va_rtti{std::forward<args>(ap)...}); \
@ -180,7 +180,7 @@ struct name \
:parent \ :parent \
{ \ { \
template<class... args> \ template<class... args> \
name(const char *const &fmt = " ", args&&... ap) noexcept \ name(const string_view &fmt = " ", args&&... ap) noexcept \
:parent{generate_skip} \ :parent{generate_skip} \
{ \ { \
generate(fmt, ircd::va_rtti{std::forward<args>(ap)...}); \ generate(fmt, ircd::va_rtti{std::forward<args>(ap)...}); \
@ -204,7 +204,7 @@ struct name \
:parent \ :parent \
{ \ { \
template<class... args> \ template<class... args> \
name(const char *const &fmt = " ", args&&... ap) noexcept(RB_DEBUG_LEVEL) \ name(const string_view &fmt = " ", args&&... ap) noexcept(RB_DEBUG_LEVEL) \
:parent{generate_skip} \ :parent{generate_skip} \
{ \ { \
generate(#name, fmt, ircd::va_rtti{std::forward<args>(ap)...}); \ generate(#name, fmt, ircd::va_rtti{std::forward<args>(ap)...}); \

View file

@ -50,7 +50,7 @@ struct ircd::http::error
error() = default; error() = default;
error(const http::code &, std::string content = {}, std::string headers = {}); error(const http::code &, std::string content = {}, std::string headers = {});
error(const http::code &, std::string content, const vector_view<const header> &); error(const http::code &, std::string content, const vector_view<const header> &);
template<class... args> error(const http::code &, const char *const &fmt, args&&...); template<class... args> error(const http::code &, const string_view &fmt, args&&...);
}; };
/// Represents a single \r\n delimited line used in HTTP. /// Represents a single \r\n delimited line used in HTTP.
@ -335,7 +335,7 @@ const
template<class... args> template<class... args>
ircd::http::error::error(const http::code &code, ircd::http::error::error(const http::code &code,
const char *const &fmt, const string_view &fmt,
args&&... a) args&&... a)
:http::error :http::error
{ {

View file

@ -34,8 +34,8 @@ class ircd::m::error
static thread_local char fmtbuf[768]; static thread_local char fmtbuf[768];
public: public:
template<class... args> error(const http::code &, const string_view &errcode, const char *const &fmt, args&&...); template<class... args> error(const http::code &, const string_view &errcode, const string_view &fmt, args&&...);
template<class... args> error(const string_view &errcode, const char *const &fmt, args&&...); template<class... args> error(const string_view &errcode, const string_view &fmt, args&&...);
error(const http::code &, const json::object &object); error(const http::code &, const json::object &object);
error(const http::code &, const json::members &); error(const http::code &, const json::members &);
error(const http::code &, const json::iov &); error(const http::code &, const json::iov &);
@ -76,7 +76,7 @@ struct _name_ \
child, _httpcode_, "M_"#_name_, "%s", http::status(_httpcode_) \ child, _httpcode_, "M_"#_name_, "%s", http::status(_httpcode_) \
}{} \ }{} \
\ \
template<class... args> _name_(const char *const &fmt, args&&... a) \ template<class... args> _name_(const string_view &fmt, args&&... a) \
: _parent_ \ : _parent_ \
{ \ { \
child, _httpcode_, "M_"#_name_, fmt, std::forward<args>(a)... \ child, _httpcode_, "M_"#_name_, fmt, std::forward<args>(a)... \
@ -110,7 +110,7 @@ namespace ircd::m
template<class... args> template<class... args>
ircd::m::error::error(const http::code &status, ircd::m::error::error(const http::code &status,
const string_view &errcode, const string_view &errcode,
const char *const &fmt, const string_view &fmt,
args&&... a) args&&... a)
:http::error :http::error
{ {
@ -131,7 +131,7 @@ ircd::m::error::error(const http::code &status,
template<class... args> template<class... args>
ircd::m::error::error(const string_view &errcode, ircd::m::error::error(const string_view &errcode,
const char *const &fmt, const string_view &fmt,
args&&... a) args&&... a)
:error :error
{ {

View file

@ -253,13 +253,13 @@ struct ircd::m::vm::error
{ {
vm::fault code; vm::fault code;
template<class... args> error(const fault &code, const char *const &fmt, args&&... a); template<class... args> error(const fault &code, const string_view &fmt, args&&... a);
template<class... args> error(const char *const &fmt, args&&... a); template<class... args> error(const string_view &fmt, args&&... a);
}; };
template<class... args> template<class... args>
ircd::m::vm::error::error(const fault &code, ircd::m::vm::error::error(const fault &code,
const char *const &fmt, const string_view &fmt,
args&&... a) args&&... a)
:m::error :m::error
{ {
@ -272,7 +272,7 @@ ircd::m::vm::error::error(const fault &code,
{} {}
template<class... args> template<class... args>
ircd::m::vm::error::error(const char *const &fmt, ircd::m::vm::error::error(const string_view &fmt,
args&&... a) args&&... a)
:m::error :m::error
{ {

View file

@ -200,7 +200,7 @@ ircd::make_error_code(const std::error_code &ec)
// //
ssize_t ssize_t
ircd::exception::generate(const char *const &fmt, ircd::exception::generate(const string_view &fmt,
const va_rtti &ap) const va_rtti &ap)
noexcept noexcept
{ {
@ -209,7 +209,7 @@ noexcept
ssize_t ssize_t
ircd::exception::generate(const char *const &name, ircd::exception::generate(const char *const &name,
const char *const &fmt, const string_view &fmt,
const va_rtti &ap) const va_rtti &ap)
noexcept noexcept
{ {