From d2c5b1e383c0b8c8ca551df2658de5ff3b847269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 19 Oct 2014 12:33:57 +0200 Subject: Only cast once in op_case_change --- vis.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index f82ab89..6c44b12 100644 --- a/vis.c +++ b/vis.c @@ -615,15 +615,14 @@ static void op_case_change(OperatorContext *c) { len = text_bytes_get(vis->win->text, c->range.start, len, buf); size_t rem = len; for (char *cur = buf; rem > 0; cur++, rem--) { - if (isascii((unsigned char)*cur)) { - if (c->arg->i == 0) { - *cur = islower((unsigned char)*cur) ? - toupper((unsigned char)*cur) : - tolower((unsigned char)*cur) ; - } else if (c->arg->i > 0) - *cur = toupper((unsigned char)*cur); + int ch = (unsigned char)*cur; + if (isascii(ch)) { + if (c->arg->i == 0) + *cur = islower(ch) ? toupper(ch) : tolower(ch); + else if (c->arg->i > 0) + *cur = toupper(ch); else - *cur = tolower((unsigned char)*cur); + *cur = tolower(ch); } } -- cgit v1.2.3