aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/keymap.c2
-rw-r--r--src/nvim/macros.h1
-rw-r--r--src/nvim/mbyte.h3
-rw-r--r--src/nvim/ops.c6
-rw-r--r--src/nvim/regexp.c4
-rw-r--r--src/nvim/regexp_nfa.c21
-rw-r--r--src/nvim/screen.c6
-rw-r--r--src/nvim/spell.c4
-rw-r--r--src/nvim/spellfile.c4
10 files changed, 25 insertions, 28 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 8b6bab12fc..41bf38d76b 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3461,7 +3461,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (fillchar == 0) {
fillchar = ' ';
- } else if (mb_char2len(fillchar) > 1) {
+ } else if (utf_char2len(fillchar) > 1) {
// Can't handle a multi-byte fill character yet.
fillchar = '-';
}
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index b17ce5d668..81e5cf6ed5 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -477,7 +477,7 @@ char_u *get_special_key_name(int c, int modifiers)
* extract modifiers.
*/
if (c > 0
- && (*mb_char2len)(c) == 1) {
+ && utf_char2len(c) == 1) {
if (table_idx < 0
&& (!vim_isprintc(c) || (c & 0x7f) == ' ')
&& (c & 0x80)) {
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index 20147acd5f..8a969c43a1 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -114,7 +114,6 @@
#define MB_COPY_CHAR(f, t) mb_copy_char((const char_u **)(&f), &t);
#define MB_CHARLEN(p) mb_charlen(p)
-#define MB_CHAR2LEN(c) mb_char2len(c)
#define PTR2CHAR(p) utf_ptr2char(p)
#define RESET_BINDING(wp) \
diff --git a/src/nvim/mbyte.h b/src/nvim/mbyte.h
index db6baeeef4..1e5e332ad9 100644
--- a/src/nvim/mbyte.h
+++ b/src/nvim/mbyte.h
@@ -38,9 +38,6 @@
#define ENC_LATIN9 0x400 // Latin9
#define ENC_MACROMAN 0x800 // Mac Roman (not Macro Man! :-)
-// TODO(bfredl): eventually we should keep only one of the namings
-#define mb_char2len utf_char2len
-
/// Flags for vimconv_T
typedef enum {
CONV_NONE = 0,
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 942dc4d8af..7d7db2a8a6 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1847,7 +1847,7 @@ int op_replace(oparg_T *oap, int c)
// Compute bytes needed, move character count to num_chars.
num_chars = numc;
- numc *= (*mb_char2len)(c);
+ numc *= utf_char2len(c);
oldp = get_cursor_line_ptr();
oldlen = (int)STRLEN(oldp);
@@ -1926,11 +1926,11 @@ int op_replace(oparg_T *oap, int c)
while (ltoreq(curwin->w_cursor, oap->end)) {
n = gchar_cursor();
if (n != NUL) {
- if ((*mb_char2len)(c) > 1 || (*mb_char2len)(n) > 1) {
+ if (utf_char2len(c) > 1 || utf_char2len(n) > 1) {
// This is slow, but it handles replacing a single-byte
// with a multi-byte and the other way around.
if (curwin->w_cursor.lnum == oap->end.lnum) {
- oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n);
+ oap->end.col += utf_char2len(c) - utf_char2len(n);
}
replace_character(c);
} else {
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index befe398f1f..b1c1e49f61 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -2255,8 +2255,8 @@ collection:
if (startc > endc) {
EMSG_RET_NULL(_(e_reverse_range));
}
- if ((*mb_char2len)(startc) > 1
- || (*mb_char2len)(endc) > 1) {
+ if (utf_char2len(startc) > 1
+ || utf_char2len(endc) > 1) {
// Limit to a range of 256 chars
if (endc > startc + 256) {
EMSG_RET_NULL(_(e_large_class));
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 04fb77e6b3..fbaf619620 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -543,7 +543,7 @@ static char_u *nfa_get_match_text(nfa_state_T *start)
return NULL; /* just in case */
p = p->out;
while (p->c > 0) {
- len += MB_CHAR2LEN(p->c);
+ len += utf_char2len(p->c);
p = p->out;
}
if (p->c != NFA_MCLOSE || p->out->c != NFA_MATCH)
@@ -1746,8 +1746,8 @@ collection:
EMIT(endc);
EMIT(NFA_RANGE);
EMIT(NFA_CONCAT);
- } else if ((*mb_char2len)(startc) > 1
- || (*mb_char2len)(endc) > 1) {
+ } else if (utf_char2len(startc) > 1
+ || utf_char2len(endc) > 1) {
// Emit the characters in the range.
// "startc" was already emitted, so skip it.
for (c = startc + 1; c <= endc; c++) {
@@ -1828,7 +1828,7 @@ collection:
nfa_do_multibyte:
// plen is length of current char with composing chars
- if ((*mb_char2len)(c) != (plen = utfc_ptr2len(old_regparse))
+ if (utf_char2len(c) != (plen = utfc_ptr2len(old_regparse))
|| utf_iscomposing(c)) {
int i = 0;
@@ -2972,8 +2972,8 @@ static int nfa_max_width(nfa_state_T *startstate, int depth)
if (state->c < 0)
/* don't know what this is */
return -1;
- /* normal character */
- len += MB_CHAR2LEN(state->c);
+ // normal character
+ len += utf_char2len(state->c);
break;
}
@@ -5620,7 +5620,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
// Only match composing character(s), ignore base
// character. Used for ".{composing}" and "{composing}"
// (no preceding character).
- len += mb_char2len(mc);
+ len += utf_char2len(mc);
}
if (rex.reg_icombine && len == 0) {
// If \Z was present, then ignore composing characters.
@@ -5636,7 +5636,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
} else if (len > 0 || mc == sta->c) {
// Check base character matches first, unless ignored.
if (len == 0) {
- len += mb_char2len(mc);
+ len += utf_char2len(mc);
sta = sta->out;
}
@@ -5645,9 +5645,10 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
while (len < clen) {
mc = utf_ptr2char(rex.input + len);
cchars[ccount++] = mc;
- len += mb_char2len(mc);
- if (ccount == MAX_MCO)
+ len += utf_char2len(mc);
+ if (ccount == MAX_MCO) {
break;
+ }
}
// Check that each composing char in the pattern matches a
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e205f4591a..5c5466ed28 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3705,7 +3705,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
// if n_extra > 0, it gives the number of chars
// to use for a tab, else we need to calculate the width
// for a tab
- int len = (tab_len * mb_char2len(wp->w_p_lcs_chars.tab2));
+ int len = (tab_len * utf_char2len(wp->w_p_lcs_chars.tab2));
if (n_extra > 0) {
len += n_extra - tab_len;
}
@@ -3728,8 +3728,8 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
lcs = wp->w_p_lcs_chars.tab3;
}
utf_char2bytes(lcs, p);
- p += mb_char2len(lcs);
- n_extra += mb_char2len(lcs) - (saved_nextra > 0 ? 1 : 0);
+ p += utf_char2len(lcs);
+ n_extra += utf_char2len(lcs) - (saved_nextra > 0 ? 1 : 0);
}
p_extra = p_extra_free;
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 849c2d5cfe..094a160e7f 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -4644,7 +4644,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
PROF_STORE(sp->ts_state)
sp->ts_state = STATE_UNSWAP;
depth++;
- fl = mb_char2len(c2);
+ fl = utf_char2len(c2);
memmove(p, p + n, fl);
utf_char2bytes(c, p + fl);
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
@@ -4700,7 +4700,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
PROF_STORE(sp->ts_state)
sp->ts_state = STATE_UNSWAP3;
depth++;
- tl = mb_char2len(c3);
+ tl = utf_char2len(c3);
memmove(p, p + n + fl, tl);
utf_char2bytes(c2, p + tl);
utf_char2bytes(c, p + fl + tl);
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index a267164d0a..1227cd5adc 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -5858,8 +5858,8 @@ static void set_map_str(slang_T *lp, char_u *map)
// the hash table. Each entry is the char, a NUL the headchar and
// a NUL.
if (c >= 256) {
- int cl = mb_char2len(c);
- int headcl = mb_char2len(headc);
+ int cl = utf_char2len(c);
+ int headcl = utf_char2len(headc);
char_u *b;
hash_T hash;
hashitem_T *hi;