From c498b2f7eef54f9b7be7c8a8bbc0d26c73e13f18 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 17 Apr 2024 16:48:00 +0800 Subject: [PATCH] string-util: use mempcpy where appropriate --- src/basic/string-util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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'; -- 2.47.3