From 7102999334501e11d293c43fe13bd1ad982ddb2e Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 20 Mar 2008 01:53:36 +0100 Subject: [PATCH] draw_text: minor cleanup to use fewer local variables --- tig.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tig.c b/tig.c index 25cf31b..756ce47 100644 --- a/tig.c +++ b/tig.c @@ -1460,16 +1460,13 @@ static int draw_text(struct view *view, const char *string, int max_len, int col, bool use_tilde, int tilde_attr) { - int n; + int len = 0; - n = 0; if (max_len > 0) { - int len; int trimmed = FALSE; if (opt_utf8) { len = utf8_length(string, max_len, &trimmed, use_tilde); - n = len; } else { len = strlen(string); if (len > max_len) { @@ -1479,18 +1476,17 @@ draw_text(struct view *view, const char *string, int max_len, int col, len = max_len; trimmed = TRUE; } - n = len; } - waddnstr(view->win, string, n); + waddnstr(view->win, string, len); if (trimmed && use_tilde) { if (tilde_attr != -1) wattrset(view->win, tilde_attr); waddch(view->win, '~'); - n++; + len++; } } - return n; + return len; } static bool -- 2.30.2