few optimizations building string vector with arguments

- avoid unneeded copying (don't gather remaining string)
- don't build args byte by byte

Signed-off-by: Sergey G. Brester <serg.brester@sebres.de>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
This commit is contained in:
sebres
2023-03-22 14:50:45 +01:00
committed by Tino Reichardt
parent cc1192c7d9
commit 45c245645d
3 changed files with 51 additions and 24 deletions

View File

@@ -1206,6 +1206,16 @@ UString &UString::operator=(const UString &s)
return *this;
}
void UString::AddFrom(const wchar_t *s, unsigned len) // no check
{
if (len) {
Grow(len);
wmemcpy(_chars + _len, s, len);
_len += len;
_chars[_len] = 0;
}
}
void UString::SetFrom(const wchar_t *s, unsigned len) // no check
{
if (len > _limit)