From 19b8aad81df46615c799d34245e704f1ca7a391a Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 4 Aug 2022 11:57:28 -0300 Subject: misc: Add a little optimization to `remove_trailing_whitespace()` This also cleans it up a bit. --- misc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/misc.c b/misc.c index 462a3bd..12fdd2a 100644 --- a/misc.c +++ b/misc.c @@ -95,8 +95,7 @@ char *remove_trailing_whitespace(char *str) { for (char *tmp = s; !is_empty(tmp); s = tmp, tmp = find_delm(tmp, whitespace, 1)); - s = find_delm(s, whitespace, 0); - *s = '\0'; + *find_delm(s, whitespace, 0) = '\0'; return str; } -- cgit v1.2.3-13-gbd6f