Minor optimization, drop expensive memset() ops

No need to zero out whole buffer for strlcat(), or other string check
ops.  Also drop a few completely useless memset() calls.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-04-07 11:58:41 +02:00
1 parent d43af8c9c1
commit c0716d7f63
4 files changed
+6 -10

No files matched your search

+2 -2
View File
@@ -260,7 +260,7 @@ void print_banner(const char *heading)
if (progress_style == PROGRESS_SILENT)
return;
memset(buf, 0, sizeof(buf));
buf[0] = 0;
strlcat(buf, "\r\e[2K", sizeof(buf));
if (progress_style == PROGRESS_CLASSIC) {
@@ -339,7 +339,7 @@ void printv(const char *fmt, va_list ap)
delline();
memset(buf, 0, sizeof(buf));
buf[0] = 0;
len = print_timestamp(buf, sizeof(buf));
vsnprintf(&buf[len], sizeof(buf) - len, fmt, ap);