mirror of
https://github.com/matrix-construct/construct
synced 2024-11-30 10:42:47 +01:00
ircd::json: Eliminate bool return for printer call.
This commit is contained in:
parent
876f28f1df
commit
d9f8e0d0ab
1 changed files with 6 additions and 21 deletions
27
ircd/json.cc
27
ircd/json.cc
|
@ -312,10 +312,10 @@ ircd::json::printer
|
||||||
|
|
||||||
template<class gen,
|
template<class gen,
|
||||||
class... attr>
|
class... attr>
|
||||||
bool operator()(mutable_buffer &out, gen&&, attr&&...) const;
|
void operator()(mutable_buffer &out, gen&&, attr&&...) const;
|
||||||
|
|
||||||
template<class gen>
|
template<class gen>
|
||||||
bool operator()(mutable_buffer &out, gen&&) const;
|
void operator()(mutable_buffer &out, gen&&) const;
|
||||||
|
|
||||||
printer()
|
printer()
|
||||||
:printer::base_type{rule<>{}}
|
:printer::base_type{rule<>{}}
|
||||||
|
@ -461,7 +461,7 @@ noexcept
|
||||||
template<class gen,
|
template<class gen,
|
||||||
class... attr>
|
class... attr>
|
||||||
[[gnu::visibility("internal")]]
|
[[gnu::visibility("internal")]]
|
||||||
bool
|
void
|
||||||
ircd::json::printer::operator()(mutable_buffer &out,
|
ircd::json::printer::operator()(mutable_buffer &out,
|
||||||
gen&& g,
|
gen&& g,
|
||||||
attr&&... a)
|
attr&&... a)
|
||||||
|
@ -472,13 +472,11 @@ const
|
||||||
{
|
{
|
||||||
"Failed to generate JSON"
|
"Failed to generate JSON"
|
||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class gen>
|
template<class gen>
|
||||||
[[gnu::visibility("internal")]]
|
[[gnu::visibility("internal")]]
|
||||||
bool
|
void
|
||||||
ircd::json::printer::operator()(mutable_buffer &out,
|
ircd::json::printer::operator()(mutable_buffer &out,
|
||||||
gen&& g)
|
gen&& g)
|
||||||
const
|
const
|
||||||
|
@ -488,8 +486,6 @@ const
|
||||||
{
|
{
|
||||||
"Failed to generate JSON"
|
"Failed to generate JSON"
|
||||||
};
|
};
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class it_a,
|
template<class it_a,
|
||||||
|
@ -1658,13 +1654,7 @@ ircd::json::stack::member::member(object &po,
|
||||||
|
|
||||||
char tmp[512];
|
char tmp[512];
|
||||||
mutable_buffer buf{tmp};
|
mutable_buffer buf{tmp};
|
||||||
if(unlikely(!printer(buf, rule, name)))
|
printer(buf, rule, name);
|
||||||
throw error
|
|
||||||
{
|
|
||||||
"member name overflow: max size is under %zu",
|
|
||||||
sizeof(tmp)
|
|
||||||
};
|
|
||||||
|
|
||||||
assert(data(buf) >= tmp);
|
assert(data(buf) >= tmp);
|
||||||
s->append(string_view{tmp, size_t(data(buf) - tmp)});
|
s->append(string_view{tmp, size_t(data(buf) - tmp)});
|
||||||
}
|
}
|
||||||
|
@ -3281,17 +3271,12 @@ ircd::json::escape(const mutable_buffer &buf,
|
||||||
const string_view &in)
|
const string_view &in)
|
||||||
{
|
{
|
||||||
mutable_buffer out{buf};
|
mutable_buffer out{buf};
|
||||||
const bool ok
|
printer(out, printer.string, in);
|
||||||
{
|
|
||||||
printer(out, printer.string, in)
|
|
||||||
};
|
|
||||||
|
|
||||||
const string_view ret
|
const string_view ret
|
||||||
{
|
{
|
||||||
data(buf), data(out)
|
data(buf), data(out)
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(ok);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue