aboutsummaryrefslogtreecommitdiff
path: root/src/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim')
-rw-r--r--src/nvim/api/private/helpers.c4
-rw-r--r--src/nvim/autocmd.c12
-rw-r--r--src/nvim/buffer.c10
-rw-r--r--src/nvim/change.c4
-rw-r--r--src/nvim/cmdexpand.c16
-rw-r--r--src/nvim/context.c2
-rw-r--r--src/nvim/debugger.c8
-rw-r--r--src/nvim/diff.c58
-rw-r--r--src/nvim/drawline.c4
-rw-r--r--src/nvim/edit.c2
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/eval/funcs.c4
-rw-r--r--src/nvim/eval/userfunc.c34
-rw-r--r--src/nvim/eval/vars.c6
-rw-r--r--src/nvim/ex_docmd.c26
-rw-r--r--src/nvim/ex_eval.c4
-rw-r--r--src/nvim/ex_getln.c42
-rw-r--r--src/nvim/file_search.c8
-rw-r--r--src/nvim/fileio.c4
-rw-r--r--src/nvim/fold.c20
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/hardcopy.c6
-rw-r--r--src/nvim/hashtab.c4
-rw-r--r--src/nvim/help.c8
-rw-r--r--src/nvim/indent.c16
-rw-r--r--src/nvim/insexpand.c10
-rw-r--r--src/nvim/mapping.c68
-rw-r--r--src/nvim/mbyte.c30
-rw-r--r--src/nvim/memline.c34
-rw-r--r--src/nvim/menu.c26
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c30
-rw-r--r--src/nvim/option.c28
-rw-r--r--src/nvim/optionstr.c6
-rw-r--r--src/nvim/os/env.c2
-rw-r--r--src/nvim/os/fs.c2
-rw-r--r--src/nvim/profile.c2
-rw-r--r--src/nvim/regexp.c5
-rw-r--r--src/nvim/regexp_nfa.c4
-rw-r--r--src/nvim/runtime.c12
-rw-r--r--src/nvim/screen.c32
-rw-r--r--src/nvim/search.c64
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/sign.c46
-rw-r--r--src/nvim/spell.c8
-rw-r--r--src/nvim/spellfile.c6
-rw-r--r--src/nvim/spellsuggest.c51
-rw-r--r--src/nvim/syntax.c12
-rw-r--r--src/nvim/tag.c171
-rw-r--r--src/nvim/textformat.c24
-rw-r--r--src/nvim/usercmd.c12
-rw-r--r--src/nvim/vim.h10
-rw-r--r--src/nvim/window.c6
54 files changed, 510 insertions, 509 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index ca8ad16cbf..4ff600618d 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -391,13 +391,13 @@ String cbuf_to_string(const char *buf, size_t size)
String cstrn_to_string(const char *str, size_t maxsize)
FUNC_ATTR_NONNULL_ALL
{
- return cbuf_to_string(str, STRNLEN(str, maxsize));
+ return cbuf_to_string(str, strnlen(str, maxsize));
}
String cstrn_as_string(char *str, size_t maxsize)
FUNC_ATTR_NONNULL_ALL
{
- return cbuf_as_string(str, STRNLEN(str, maxsize));
+ return cbuf_as_string(str, strnlen(str, maxsize));
}
/// Creates a String using the given C string. Unlike
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 426899c581..57b5adca53 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -304,7 +304,7 @@ static void au_show_for_event(int group, event_T event, char *pat)
// all buffer-local patterns.
if ((group == AUGROUP_ALL || ap->group == group)
&& ap->patlen == patlen
- && STRNCMP(pat, ap->pat, patlen) == 0) {
+ && strncmp(pat, ap->pat, (size_t)patlen) == 0) {
// Show autocmd's for this autopat, or buflocals <buffer=X>
aupat_show(ap, event, previous_group);
previous_group = ap->group;
@@ -1002,7 +1002,7 @@ int do_autocmd_event(event_T event, char *pat, bool once, int nested, char *cmd,
// all buffer-local patterns.
if (ap->group == findgroup
&& ap->patlen == patlen
- && STRNCMP(pat, ap->pat, patlen) == 0) {
+ && strncmp(pat, ap->pat, (size_t)patlen) == 0) {
// Remove existing autocommands.
// If adding any new autocmd's for this AutoPat, don't
// delete the pattern from the autopat list, append to
@@ -1086,7 +1086,7 @@ int autocmd_register(int64_t id, event_T event, char *pat, int patlen, int group
// all buffer-local patterns.
if (ap->group == findgroup
&& ap->patlen == patlen
- && STRNCMP(pat, ap->pat, patlen) == 0) {
+ && strncmp(pat, ap->pat, (size_t)patlen) == 0) {
if (ap->next == NULL) {
// Add autocmd to this autopat, if it's the last one.
break;
@@ -1349,7 +1349,7 @@ void ex_doautoall(exarg_T *eap)
bool check_nomodeline(char **argp)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
- if (STRNCMP(*argp, "<nomodeline>", 12) == 0) {
+ if (strncmp(*argp, "<nomodeline>", 12) == 0) {
*argp = skipwhite(*argp + 12);
return false;
}
@@ -2459,7 +2459,7 @@ bool aupat_is_buflocal(char *pat, int patlen)
FUNC_ATTR_PURE
{
return patlen >= 8
- && STRNCMP(pat, "<buffer", 7) == 0
+ && strncmp(pat, "<buffer", 7) == 0
&& (pat)[patlen - 1] == '>';
}
@@ -2665,7 +2665,7 @@ static int arg_augroup_get(char **argp)
/// Handles grabbing arguments from `:autocmd` such as ++once and ++nested
static bool arg_autocmd_flag_get(bool *flag, char **cmd_ptr, char *pattern, int len)
{
- if (STRNCMP(*cmd_ptr, pattern, len) == 0 && ascii_iswhite((*cmd_ptr)[len])) {
+ if (strncmp(*cmd_ptr, pattern, (size_t)len) == 0 && ascii_iswhite((*cmd_ptr)[len])) {
if (*flag) {
semsg(_(e_duparg2), pattern);
return true;
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 485a6669ef..67c3307e50 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3735,8 +3735,8 @@ static int chk_modeline(linenr_T lnum, int flags)
prev = -1;
for (s = ml_get(lnum); *s != NUL; s++) {
if (prev == -1 || ascii_isspace(prev)) {
- if ((prev != -1 && STRNCMP(s, "ex:", (size_t)3) == 0)
- || STRNCMP(s, "vi:", (size_t)3) == 0) {
+ if ((prev != -1 && strncmp(s, "ex:", (size_t)3) == 0)
+ || strncmp(s, "vi:", (size_t)3) == 0) {
break;
}
// Accept both "vim" and "Vim".
@@ -3752,7 +3752,7 @@ static int chk_modeline(linenr_T lnum, int flags)
if (*e == ':'
&& (s[0] != 'V'
- || STRNCMP(skipwhite((char *)e + 1), "set", 3) == 0)
+ || strncmp(skipwhite(e + 1), "set", 3) == 0)
&& (s[3] == ':'
|| (VIM_VERSION_100 >= vers && isdigit(s[3]))
|| (VIM_VERSION_100 < vers && s[3] == '<')
@@ -3801,8 +3801,8 @@ static int chk_modeline(linenr_T lnum, int flags)
// "vi:set opt opt opt: foo" -- foo not interpreted
// "vi:opt opt opt: foo" -- foo interpreted
// Accept "se" for compatibility with Elvis.
- if (STRNCMP(s, "set ", (size_t)4) == 0
- || STRNCMP(s, "se ", (size_t)3) == 0) {
+ if (strncmp(s, "set ", (size_t)4) == 0
+ || strncmp(s, "se ", (size_t)3) == 0) {
if (*e != ':') { // no terminating ':'?
break;
}
diff --git a/src/nvim/change.c b/src/nvim/change.c
index d4c94a5b13..959dce6e98 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -1342,7 +1342,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// the comment leader.
if (dir == FORWARD) {
for (p = saved_line + lead_len; *p; p++) {
- if (STRNCMP(p, lead_end, n) == 0) {
+ if (strncmp(p, lead_end, n) == 0) {
comment_end = p;
lead_len = 0;
break;
@@ -2217,7 +2217,7 @@ int get_last_leader_offset(char *line, char **flags)
// beginning the com_leader.
for (off = (len2 > i ? i : len2); off > 0 && off + len1 > len2;) {
off--;
- if (!STRNCMP(string + off, com_leader, len2 - off)) {
+ if (!strncmp(string + off, com_leader, (size_t)(len2 - off))) {
if (i - off < lower_check_bound) {
lower_check_bound = i - off;
}
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 037d5b4060..f1231908c7 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -457,7 +457,7 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
s += skip_wildmenu_char(xp, s);
clen += ptr2cells((char *)s);
if ((l = utfc_ptr2len((char *)s)) > 1) {
- STRNCPY(buf + len, s, l); // NOLINT(runtime/printf)
+ strncpy((char *)buf + len, (char *)s, (size_t)l); // NOLINT(runtime/printf)
s += l - 1;
len += l;
} else {
@@ -1715,7 +1715,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
} else if (context == EXPAND_COMMANDS) {
return arg;
} else if (context == EXPAND_MAPPINGS) {
- return (const char *)set_context_in_map_cmd(xp, "map", (char_u *)arg, forceit,
+ return (const char *)set_context_in_map_cmd(xp, "map", (char *)arg, forceit,
false, false,
CMD_map);
}
@@ -1754,7 +1754,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
case CMD_snoremap:
case CMD_xmap:
case CMD_xnoremap:
- return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char_u *)arg, forceit, false,
+ return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char *)arg, forceit, false,
false, cmdidx);
case CMD_unmap:
case CMD_nunmap:
@@ -1765,7 +1765,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
case CMD_lunmap:
case CMD_sunmap:
case CMD_xunmap:
- return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char_u *)arg, forceit, false,
+ return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char *)arg, forceit, false,
true, cmdidx);
case CMD_mapclear:
case CMD_nmapclear:
@@ -1786,12 +1786,12 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
case CMD_cnoreabbrev:
case CMD_iabbrev:
case CMD_inoreabbrev:
- return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char_u *)arg, forceit, true,
+ return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char *)arg, forceit, true,
false, cmdidx);
case CMD_unabbreviate:
case CMD_cunabbrev:
case CMD_iunabbrev:
- return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char_u *)arg, forceit, true,
+ return (const char *)set_context_in_map_cmd(xp, (char *)cmd, (char *)arg, forceit, true,
true, cmdidx);
case CMD_menu:
case CMD_noremenu:
@@ -2445,7 +2445,7 @@ static int ExpandFromContext(expand_T *xp, char *pat, int *num_file, char ***fil
// When expanding a function name starting with s:, match the <SNR>nr_
// prefix.
char *tofree = NULL;
- if (xp->xp_context == EXPAND_USER_FUNC && STRNCMP(pat, "^s:", 3) == 0) {
+ if (xp->xp_context == EXPAND_USER_FUNC && strncmp(pat, "^s:", 3) == 0) {
const size_t len = strlen(pat) + 20;
tofree = xmalloc(len);
@@ -2628,7 +2628,7 @@ static void expand_shellcmd(char *filepat, int *num_file, char ***file, int flag
// Find directories in the current directory, path is empty.
did_curdir = true;
flags |= EW_DIR;
- } else if (STRNCMP(s, ".", e - s) == 0) {
+ } else if (strncmp(s, ".", (size_t)(e - s)) == 0) {
did_curdir = true;
flags |= EW_DIR;
} else {
diff --git a/src/nvim/context.c b/src/nvim/context.c
index 47e60373bf..b064a92b74 100644
--- a/src/nvim/context.c
+++ b/src/nvim/context.c
@@ -264,7 +264,7 @@ static inline void ctx_save_funcs(Context *ctx, bool scriptonly)
HASHTAB_ITER(func_tbl_get(), hi, {
const char *const name = hi->hi_key;
- bool islambda = (STRNCMP(name, "<lambda>", 8) == 0);
+ bool islambda = (strncmp(name, "<lambda>", 8) == 0);
bool isscript = ((uint8_t)name[0] == K_SPECIAL);
if (!islambda && (!scriptonly || isscript)) {
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index aa9e2a9a82..fadb014604 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -515,18 +515,18 @@ static int dbg_parsearg(char *arg, garray_T *gap)
struct debuggy *bp = &DEBUGGY(gap, gap->ga_len);
// Find "func" or "file".
- if (STRNCMP(p, "func", 4) == 0) {
+ if (strncmp(p, "func", 4) == 0) {
bp->dbg_type = DBG_FUNC;
- } else if (STRNCMP(p, "file", 4) == 0) {
+ } else if (strncmp(p, "file", 4) == 0) {
bp->dbg_type = DBG_FILE;
- } else if (gap != &prof_ga && STRNCMP(p, "here", 4) == 0) {
+ } else if (gap != &prof_ga && strncmp(p, "here", 4) == 0) {
if (curbuf->b_ffname == NULL) {
emsg(_(e_noname));
return FAIL;
}
bp->dbg_type = DBG_FILE;
here = true;
- } else if (gap != &prof_ga && STRNCMP(p, "expr", 4) == 0) {
+ } else if (gap != &prof_ga && strncmp(p, "expr", 4) == 0) {
bp->dbg_type = DBG_EXPR;
} else {
semsg(_(e_invarg2), p);
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index c28eecc76a..1ae0e91cda 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1047,8 +1047,8 @@ static int check_external_diff(diffio_T *diffio)
break;
}
- if (STRNCMP(linebuf, "1c1", 3) == 0
- || STRNCMP(linebuf, "@@ -1 +1 @@", 11) == 0) {
+ if (strncmp(linebuf, "1c1", 3) == 0
+ || strncmp(linebuf, "@@ -1 +1 @@", 11) == 0) {
ok = kTrue;
}
}
@@ -1573,13 +1573,13 @@ static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle)
// @@ -1,3 +1,5 @@
if (isdigit(*line)) {
*diffstyle = DIFF_ED;
- } else if ((STRNCMP(line, "@@ ", 3) == 0)) {
+ } else if ((strncmp(line, "@@ ", 3) == 0)) {
*diffstyle = DIFF_UNIFIED;
- } else if ((STRNCMP(line, "--- ", 4) == 0) // -V501
+ } else if ((strncmp(line, "--- ", 4) == 0) // -V501
&& (vim_fgets(line, LBUFLEN, fd) == 0) // -V501
- && (STRNCMP(line, "+++ ", 4) == 0)
+ && (strncmp(line, "+++ ", 4) == 0)
&& (vim_fgets(line, LBUFLEN, fd) == 0) // -V501
- && (STRNCMP(line, "@@ ", 3) == 0)) {
+ && (strncmp(line, "@@ ", 3) == 0)) {
*diffstyle = DIFF_UNIFIED;
} else {
// Format not recognized yet, skip over this line. Cygwin diff
@@ -1597,7 +1597,7 @@ static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle)
}
} else {
assert(*diffstyle == DIFF_UNIFIED);
- if (STRNCMP(line, "@@ ", 3) != 0) {
+ if (strncmp(line, "@@ ", 3) != 0) {
continue; // not the start of a diff block
}
if (parse_diff_unified(line, hunk) == FAIL) {
@@ -2263,7 +2263,7 @@ static bool diff_equal_char(const char *const p1, const char *const p2, int *con
return false;
}
if (l > 1) {
- if (STRNCMP(p1, p2, l) != 0
+ if (strncmp(p1, p2, (size_t)l) != 0
&& (!(diff_flags & DIFF_ICASE)
|| utf_fold(utf_ptr2char(p1)) != utf_fold(utf_ptr2char(p2)))) {
return false;
@@ -2466,69 +2466,69 @@ int diffopt_changed(void)
char *p = p_dip;
while (*p != NUL) {
- if (STRNCMP(p, "filler", 6) == 0) {
+ if (strncmp(p, "filler", 6) == 0) {
p += 6;
diff_flags_new |= DIFF_FILLER;
- } else if ((STRNCMP(p, "context:", 8) == 0) && ascii_isdigit(p[8])) {
+ } else if ((strncmp(p, "context:", 8) == 0) && ascii_isdigit(p[8])) {
p += 8;
diff_context_new = getdigits_int(&p, false, diff_context_new);
- } else if (STRNCMP(p, "iblank", 6) == 0) {
+ } else if (strncmp(p, "iblank", 6) == 0) {
p += 6;
diff_flags_new |= DIFF_IBLANK;
- } else if (STRNCMP(p, "icase", 5) == 0) {
+ } else if (strncmp(p, "icase", 5) == 0) {
p += 5;
diff_flags_new |= DIFF_ICASE;
- } else if (STRNCMP(p, "iwhiteall", 9) == 0) {
+ } else if (strncmp(p, "iwhiteall", 9) == 0) {
p += 9;
diff_flags_new |= DIFF_IWHITEALL;
- } else if (STRNCMP(p, "iwhiteeol", 9) == 0) {
+ } else if (strncmp(p, "iwhiteeol", 9) == 0) {
p += 9;
diff_flags_new |= DIFF_IWHITEEOL;
- } else if (STRNCMP(p, "iwhite", 6) == 0) {
+ } else if (strncmp(p, "iwhite", 6) == 0) {
p += 6;
diff_flags_new |= DIFF_IWHITE;
- } else if (STRNCMP(p, "horizontal", 10) == 0) {
+ } else if (strncmp(p, "horizontal", 10) == 0) {
p += 10;
diff_flags_new |= DIFF_HORIZONTAL;
- } else if (STRNCMP(p, "vertical", 8) == 0) {
+ } else if (strncmp(p, "vertical", 8) == 0) {
p += 8;
diff_flags_new |= DIFF_VERTICAL;
- } else if ((STRNCMP(p, "foldcolumn:", 11) == 0) && ascii_isdigit(p[11])) {
+ } else if ((strncmp(p, "foldcolumn:", 11) == 0) && ascii_isdigit(p[11])) {
p += 11;
diff_foldcolumn_new = getdigits_int(&p, false, diff_foldcolumn_new);
- } else if (STRNCMP(p, "hiddenoff", 9) == 0) {
+ } else if (strncmp(p, "hiddenoff", 9) == 0) {
p += 9;
diff_flags_new |= DIFF_HIDDEN_OFF;
- } else if (STRNCMP(p, "closeoff", 8) == 0) {
+ } else if (strncmp(p, "closeoff", 8) == 0) {
p += 8;
diff_flags_new |= DIFF_CLOSE_OFF;
- } else if (STRNCMP(p, "followwrap", 10) == 0) {
+ } else if (strncmp(p, "followwrap", 10) == 0) {
p += 10;
diff_flags_new |= DIFF_FOLLOWWRAP;
- } else if (STRNCMP(p, "indent-heuristic", 16) == 0) {
+ } else if (strncmp(p, "indent-heuristic", 16) == 0) {
p += 16;
diff_indent_heuristic = XDF_INDENT_HEURISTIC;
- } else if (STRNCMP(p, "internal", 8) == 0) {
+ } else if (strncmp(p, "internal", 8) == 0) {
p += 8;
diff_flags_new |= DIFF_INTERNAL;
- } else if (STRNCMP(p, "algorithm:", 10) == 0) {
+ } else if (strncmp(p, "algorithm:", 10) == 0) {
p += 10;
- if (STRNCMP(p, "myers", 5) == 0) {
+ if (strncmp(p, "myers", 5) == 0) {
p += 5;
diff_algorithm_new = 0;
- } else if (STRNCMP(p, "minimal", 7) == 0) {
+ } else if (strncmp(p, "minimal", 7) == 0) {
p += 7;
diff_algorithm_new = XDF_NEED_MINIMAL;
- } else if (STRNCMP(p, "patience", 8) == 0) {
+ } else if (strncmp(p, "patience", 8) == 0) {
p += 8;
diff_algorithm_new = XDF_PATIENCE_DIFF;
- } else if (STRNCMP(p, "histogram", 9) == 0) {
+ } else if (strncmp(p, "histogram", 9) == 0) {
p += 9;
diff_algorithm_new = XDF_HISTOGRAM_DIFF;
} else {
return FAIL;
}
- } else if ((STRNCMP(p, "linematch:", 10) == 0) && ascii_isdigit(p[10])) {
+ } else if ((strncmp(p, "linematch:", 10) == 0) && ascii_isdigit(p[10])) {
p += 10;
linematch_lines_new = getdigits_int(&p, false, linematch_lines_new);
diff_flags_new |= DIFF_LINEMATCH;
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index b5704897ad..b5119ca8a2 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -2098,7 +2098,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
c = (uint8_t)(*p_extra);
p = xmalloc((size_t)n_extra + 1);
memset(p, ' ', (size_t)n_extra);
- STRNCPY(p, p_extra + 1, strlen(p_extra) - 1); // NOLINT(runtime/printf)
+ strncpy((char *)p, // NOLINT(runtime/printf)
+ p_extra + 1,
+ (size_t)strlen(p_extra) - 1);
p[n_extra] = NUL;
xfree(p_extra_free);
p_extra_free = p_extra = (char *)p;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 6a5f55ad79..ac2973ba68 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1469,7 +1469,7 @@ static void init_prompt(int cmdchar_todo)
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
text = get_cursor_line_ptr();
- if (STRNCMP(text, prompt, strlen(prompt)) != 0) {
+ if (strncmp(text, prompt, strlen(prompt)) != 0) {
// prompt is missing, insert it or append a line with it
if (*text == NUL) {
ml_replace(curbuf->b_ml.ml_line_count, prompt, true);
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 005207718b..89fda1d8f5 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2084,7 +2084,7 @@ void del_menutrans_vars(void)
{
hash_lock(&globvarht);
HASHTAB_ITER(&globvarht, hi, {
- if (STRNCMP(hi->hi_key, "menutrans_", 10) == 0) {
+ if (strncmp(hi->hi_key, "menutrans_", 10) == 0) {
delete_var(&globvarht, hi);
}
});
@@ -2142,7 +2142,7 @@ char *get_user_var_name(expand_T *xp, int idx)
while (HASHITEM_EMPTY(hi)) {
hi++;
}
- if (STRNCMP("g:", xp->xp_pattern, 2) == 0) {
+ if (strncmp("g:", xp->xp_pattern, 2) == 0) {
return cat_prefix_varname('g', hi->hi_key);
}
return hi->hi_key;
@@ -3323,7 +3323,7 @@ static int eval_method(char **const arg, typval_T *const rettv, const bool evalu
int len;
char *name = *arg;
char *lua_funcname = NULL;
- if (STRNCMP(name, "v:lua.", 6) == 0) {
+ if (strncmp(name, "v:lua.", 6) == 0) {
lua_funcname = name + 6;
*arg = (char *)skip_luafunc_name((const char *)lua_funcname);
*arg = skipwhite(*arg); // to detect trailing whitespace later
@@ -5041,7 +5041,7 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref)
int dict_idx = 0;
int arg_idx = 0;
list_T *list = NULL;
- if (STRNCMP(s, "s:", 2) == 0 || STRNCMP(s, "<SID>", 5) == 0) {
+ if (strncmp(s, "s:", 2) == 0 || strncmp(s, "<SID>", 5) == 0) {
char sid_buf[25];
int off = *s == 's' ? 2 : 5;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 67da5803d9..ebe7e0325b 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -173,7 +173,7 @@ char *get_function_name(expand_T *xp, int idx)
char_u *name = (char_u *)get_user_func_name(xp, idx);
if (name != NULL) {
if (*name != NUL && *name != '<'
- && STRNCMP("g:", xp->xp_pattern, 2) == 0) {
+ && strncmp("g:", xp->xp_pattern, 2) == 0) {
return cat_prefix_varname('g', (char *)name);
}
return (char *)name;
@@ -9476,7 +9476,7 @@ static void f_tr(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
int fromlen;
for (const char *p = fromstr; *p != NUL; p += fromlen) {
fromlen = utfc_ptr2len(p);
- if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0) {
+ if (fromlen == inlen && strncmp(in_str, p, (size_t)inlen) == 0) {
int tolen;
for (p = tostr; *p != NUL; p += tolen) {
tolen = utfc_ptr2len(p);
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 7f0ac06f60..359ce08554 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -118,8 +118,8 @@ static int get_function_args(char **argp, char_u endchar, garray_T *newargs, int
p++;
}
if (arg == p || isdigit(*arg)
- || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
- || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) {
+ || (p - arg == 9 && strncmp(arg, "firstline", 9) == 0)
+ || (p - arg == 8 && strncmp(arg, "lastline", 8) == 0)) {
if (!skip) {
semsg(_("E125: Illegal argument: %s"), arg);
}
@@ -887,7 +887,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
ga_init(&fc->fc_funcs, sizeof(ufunc_T *), 1);
func_ptr_ref(fp);
- if (STRNCMP(fp->uf_name, "<lambda>", 8) == 0) {
+ if (strncmp(fp->uf_name, "<lambda>", 8) == 0) {
islambda = true;
}
@@ -1846,7 +1846,7 @@ char_u *trans_function_name(char **pp, bool skip, int flags, funcdict_T *fdp, pa
if (name != NULL) {
name = xstrdup(name);
*pp = (char *)end;
- if (STRNCMP(name, "<SNR>", 5) == 0) {
+ if (strncmp(name, "<SNR>", 5) == 0) {
// Change "<SNR>" to the byte sequence.
name[0] = (char)K_SPECIAL;
name[1] = (char)KS_EXTRA;
@@ -2187,16 +2187,16 @@ void ex_function(exarg_T *eap)
// find extra arguments "range", "dict", "abort" and "closure"
for (;;) {
p = skipwhite(p);
- if (STRNCMP(p, "range", 5) == 0) {
+ if (strncmp(p, "range", 5) == 0) {
flags |= FC_RANGE;
p += 5;
- } else if (STRNCMP(p, "dict", 4) == 0) {
+ } else if (strncmp(p, "dict", 4) == 0) {
flags |= FC_DICT;
p += 4;
- } else if (STRNCMP(p, "abort", 5) == 0) {
+ } else if (strncmp(p, "abort", 5) == 0) {
flags |= FC_ABORT;
p += 5;
- } else if (STRNCMP(p, "closure", 7) == 0) {
+ } else if (strncmp(p, "closure", 7) == 0) {
flags |= FC_CLOSURE;
p += 7;
if (current_funccal == NULL) {
@@ -2298,7 +2298,7 @@ void ex_function(exarg_T *eap)
// * ":let {var-name} =<< [trim] {marker}" and "{marker}"
if (heredoc_trimmed == NULL
|| (is_heredoc && skipwhite(theline) == theline)
- || STRNCMP(theline, heredoc_trimmed,
+ || strncmp(theline, heredoc_trimmed,
strlen(heredoc_trimmed)) == 0) {
if (heredoc_trimmed == NULL) {
p = theline;
@@ -2348,12 +2348,12 @@ void ex_function(exarg_T *eap)
// Increase indent inside "if", "while", "for" and "try", decrease
// at "end".
- if (indent > 2 && STRNCMP(p, "end", 3) == 0) {
+ if (indent > 2 && strncmp(p, "end", 3) == 0) {
indent -= 2;
- } else if (STRNCMP(p, "if", 2) == 0
- || STRNCMP(p, "wh", 2) == 0
- || STRNCMP(p, "for", 3) == 0
- || STRNCMP(p, "try", 3) == 0) {
+ } else if (strncmp(p, "if", 2) == 0
+ || strn