mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
string-util: use mempcpy where appropriate
This commit is contained in:
@@ -392,8 +392,7 @@ static char *ascii_ellipsize_mem(const char *s, size_t old_length, size_t new_le
|
||||
x = ((new_length - need_space) * percent + 50) / 100;
|
||||
assert(x <= new_length - need_space);
|
||||
|
||||
memcpy(t, s, x);
|
||||
write_ellipsis(t + x, /* unicode = */ false);
|
||||
write_ellipsis(mempcpy(t, s, x), /* unicode = */ false);
|
||||
suffix_len = new_length - x - need_space;
|
||||
memcpy(t + x + 3, s + old_length - suffix_len, suffix_len);
|
||||
*(t + x + 3 + suffix_len) = '\0';
|
||||
|
||||
Reference in New Issue
Block a user