From efb24a431007012a31641b25ea2c1857d5d8d803 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 17 Oct 2024 12:23:03 -0400 Subject: dstring: Add an infallible dstrshrink() function And mark the fallible ones with _nodiscard. --- src/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/eval.c') diff --git a/src/eval.c b/src/eval.c index 57b4bd1..6e9fffd 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1164,7 +1164,7 @@ static void eval_status(struct bfs_eval *state, struct bfs_bar *bar, size_t coun size_t rhslen = xstrwidth(rhs); if (3 + rhslen > width) { - dstresize(&rhs, 0); + dstrshrink(rhs, 0); rhslen = 0; } @@ -1208,7 +1208,7 @@ static void eval_status(struct bfs_eval *state, struct bfs_bar *bar, size_t coun } pathwidth += cwidth; } - dstresize(&status, lhslen); + dstrshrink(status, lhslen); if (dstrcat(&status, "...") != 0) { goto out; -- cgit v1.2.3