From: Mike Yuan Date: Wed, 17 Apr 2024 08:48:00 +0000 (+0800) Subject: string-util: use mempcpy where appropriate X-Git-Tag: v256-rc1~159^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c498b2f7eef54f9b7be7c8a8bbc0d26c73e13f18;p=thirdparty%2Fsystemd.git string-util: use mempcpy where appropriate --- diff --git a/src/basic/string-util.c b/src/basic/string-util.c index 0a108f4b119..d0d33a407a6 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -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';