0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-31 19:08:59 +01: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)))
};
}