aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorZviRackover <zvirack@gmail.com>2018-09-02 02:14:47 +0300
committerZviRackover <zvirack@gmail.com>2018-09-09 10:45:50 +0300
commit329cfc3303cffd5c9aad7b2ad7f4323354d68b0d (patch)
treee9abce8472ef283396c7830947c56e1d6154ef86 /src/nvim/regexp.c
parentac13e65ae0ce98516e816ba4fcf468d19e750c30 (diff)
downloadrneovim-329cfc3303cffd5c9aad7b2ad7f4323354d68b0d.tar.gz
rneovim-329cfc3303cffd5c9aad7b2ad7f4323354d68b0d.tar.bz2
rneovim-329cfc3303cffd5c9aad7b2ad7f4323354d68b0d.zip
lint: clean-up after parent commits
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 085b70ad7e..4f51a8b4cf 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -2538,10 +2538,11 @@ static void regc(int b)
*/
static void regmbc(int c)
{
- if (regcode == JUST_CALC_SIZE)
+ if (regcode == JUST_CALC_SIZE) {
regsize += utf_char2len(c);
- else
+ } else {
regcode += utf_char2bytes(c, regcode);
+ }
}
/*
@@ -6757,22 +6758,23 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
cc = c;
}
- int totlen = utfc_ptr2len(src - 1);
+ int totlen = utfc_ptr2len(src - 1);
- if (copy)
- utf_char2bytes(cc, dst);
- dst += utf_char2len(cc) - 1;
- int clen = utf_ptr2len(src - 1);
+ if (copy) {
+ utf_char2bytes(cc, dst);
+ }
+ dst += utf_char2len(cc) - 1;
+ int clen = utf_ptr2len(src - 1);
- /* If the character length is shorter than "totlen", there
- * are composing characters; copy them as-is. */
- if (clen < totlen) {
- if (copy)
- memmove(dst + 1, src - 1 + clen,
- (size_t)(totlen - clen));
- dst += totlen - clen;
+ // If the character length is shorter than "totlen", there
+ // are composing characters; copy them as-is.
+ if (clen < totlen) {
+ if (copy) {
+ memmove(dst + 1, src - 1 + clen, (size_t)(totlen - clen));
}
- src += totlen - 1;
+ dst += totlen - clen;
+ }
+ src += totlen - 1;
dst++;
} else {
if (REG_MULTI) {
@@ -6849,20 +6851,19 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
if (has_mbyte) {
int l;
- /* Copy composing characters separately, one
- * at a time. */
- if (enc_utf8)
- l = utf_ptr2len(s) - 1;
- else
- l = utfc_ptr2len(s) - 1;
+ // Copy composing characters separately, one
+ // at a time.
+ l = utf_ptr2len(s) - 1;
s += l;
len -= l;
- if (copy)
+ if (copy) {
utf_char2bytes(cc, dst);
+ }
dst += utf_char2len(cc) - 1;
- } else if (copy)
+ } else if (copy) {
*dst = cc;
+ }
dst++;
}