[PATCH wireguard-tools] src/show: remove dead offset check code
Hangbin Liu
liuhangbin at gmail.com
Mon May 17 09:10:53 UTC 2021
At first the offset will always be 0. So the check of offset ? ", " : ""
is useless.
Signed-off-by: Hangbin Liu <liuhangbin at gmail.com>
---
src/show.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/show.c b/src/show.c
index 761858b..83d4d6b 100644
--- a/src/show.c
+++ b/src/show.c
@@ -141,7 +141,7 @@ static size_t pretty_time(char *buf, const size_t len, unsigned long long left)
seconds = left % 60;
if (years)
- offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "year%s" TERMINAL_RESET, offset ? ", " : "", years, years == 1 ? "" : "s");
+ offset = snprintf(buf, len, "%llu " TERMINAL_FG_CYAN "year%s" TERMINAL_RESET, years, years == 1 ? "" : "s");
if (days)
offset += snprintf(buf + offset, len - offset, "%s%llu " TERMINAL_FG_CYAN "day%s" TERMINAL_RESET, offset ? ", " : "", days, days == 1 ? "" : "s");
if (hours)
--
2.26.3
More information about the WireGuard
mailing list