0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-01 01:28:54 +02:00

ircd::strl: Simplify strlcat; reuse strlcpy. (related f705df096d).

This commit is contained in:
Jason Volk 2022-07-03 11:21:26 -07:00
parent 4956716431
commit cc1028bd8f

View file

@ -35,6 +35,11 @@ struct ircd::strlcpy
mutable_buffer ret;
public:
explicit operator const mutable_buffer &() const
{
return ret;
}
operator string_view() const
{
return ret;
@ -97,16 +102,14 @@ struct ircd::strlcat
};
assert(pos <= max);
const auto remain
const mutable_buffer tgt
{
max - pos
dst + pos, max - pos
};
strlcpy(dst + pos, src, remain);
assert(pos + src.size() <= max);
ret = mutable_buffer
{
dst, pos + src.size()
dst, end(mutable_buffer(strlcpy(tgt, src)))
};
}