mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 00:10:59 +01:00
modules/console: Use fs::fd for loopy io.
This commit is contained in:
parent
f8ea91cdee
commit
8a173d802d
1 changed files with 13 additions and 3 deletions
|
@ -2765,6 +2765,11 @@ console_cmd__events__dump(opt &out, const string_view &line)
|
||||||
param.at(0)
|
param.at(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fs::fd file
|
||||||
|
{
|
||||||
|
filename, std::ios::out | std::ios::app
|
||||||
|
};
|
||||||
|
|
||||||
const unique_buffer<mutable_buffer> buf
|
const unique_buffer<mutable_buffer> buf
|
||||||
{
|
{
|
||||||
size_t(events_dump_buffer_size)
|
size_t(events_dump_buffer_size)
|
||||||
|
@ -2788,7 +2793,7 @@ console_cmd__events__dump(opt &out, const string_view &line)
|
||||||
if(pos + m::event::MAX_SIZE > data(buf) + size(buf))
|
if(pos + m::event::MAX_SIZE > data(buf) + size(buf))
|
||||||
{
|
{
|
||||||
const const_buffer cb{data(buf), pos};
|
const const_buffer cb{data(buf), pos};
|
||||||
foff += size(fs::append(filename, cb));
|
foff += size(fs::append(file, cb));
|
||||||
pos = data(buf);
|
pos = data(buf);
|
||||||
++acount;
|
++acount;
|
||||||
|
|
||||||
|
@ -2818,7 +2823,7 @@ console_cmd__events__dump(opt &out, const string_view &line)
|
||||||
if(pos > data(buf))
|
if(pos > data(buf))
|
||||||
{
|
{
|
||||||
const const_buffer cb{data(buf), pos};
|
const const_buffer cb{data(buf), pos};
|
||||||
foff += size(fs::append(filename, cb));
|
foff += size(fs::append(file, cb));
|
||||||
++acount;
|
++acount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3311,6 +3316,11 @@ console_cmd__eval__file(opt &out, const string_view &line)
|
||||||
token.at(0)
|
token.at(0)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fs::fd file
|
||||||
|
{
|
||||||
|
path
|
||||||
|
};
|
||||||
|
|
||||||
const auto limit
|
const auto limit
|
||||||
{
|
{
|
||||||
token.at<size_t>(1)
|
token.at<size_t>(1)
|
||||||
|
@ -3355,7 +3365,7 @@ console_cmd__eval__file(opt &out, const string_view &line)
|
||||||
static char buf[512_KiB];
|
static char buf[512_KiB];
|
||||||
const string_view read
|
const string_view read
|
||||||
{
|
{
|
||||||
ircd::fs::read(path, buf, foff)
|
fs::read(file, buf, foff)
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t boff(0);
|
size_t boff(0);
|
||||||
|
|
Loading…
Reference in a new issue