diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-10-19 12:33:57 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-10-19 12:33:57 +0200 |
| commit | d2c5b1e383c0b8c8ca551df2658de5ff3b847269 (patch) | |
| tree | db4a428b182d4bd8539acb02a5899c02a04364bb | |
| parent | b37f9e461798ba77e19ab20d7ca18555d1171e19 (diff) | |
| download | vis-d2c5b1e383c0b8c8ca551df2658de5ff3b847269.tar.gz vis-d2c5b1e383c0b8c8ca551df2658de5ff3b847269.tar.xz | |
Only cast once in op_case_change
| -rw-r--r-- | vis.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -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); } } |
