mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 08:24:08 +01:00
ircd::db: Minor simplify db::read(column).
This commit is contained in:
parent
e24295c640
commit
e6fe7805c1
1 changed files with 7 additions and 8 deletions
15
ircd/db.cc
15
ircd/db.cc
|
@ -3836,13 +3836,13 @@ ircd::db::read(column &column,
|
||||||
const gopts &gopts)
|
const gopts &gopts)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
const auto copy([&ret]
|
const auto closure([&ret]
|
||||||
(const string_view &src)
|
(const string_view &src)
|
||||||
{
|
{
|
||||||
ret.assign(begin(src), end(src));
|
ret.assign(begin(src), end(src));
|
||||||
});
|
});
|
||||||
|
|
||||||
column(key, copy, gopts);
|
column(key, closure, gopts);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3852,16 +3852,15 @@ ircd::db::read(column &column,
|
||||||
const mutable_buffer &buf,
|
const mutable_buffer &buf,
|
||||||
const gopts &gopts)
|
const gopts &gopts)
|
||||||
{
|
{
|
||||||
size_t len(0);
|
string_view ret;
|
||||||
const auto copy([&len, &buf]
|
const auto closure([&ret, &buf]
|
||||||
(const string_view &src)
|
(const string_view &src)
|
||||||
{
|
{
|
||||||
len = std::min(size(src), size(buf));
|
ret = { data(buf), copy(buf, src) };
|
||||||
memcpy(data(buf), data(src), len);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
column(key, copy, gopts);
|
column(key, closure, gopts);
|
||||||
return { data(buf), len };
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Reference in a new issue