aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-04-25 04:18:43 +0200
committerGitHub <noreply@github.com>2022-04-24 20:18:43 -0600
commit0648100fed65cbe8efe774ae997ab841cae01872 (patch)
tree4b2b5a41f58ddf442a69726f6a315c393317714b
parent7813fa2f8cc3885788abc5c5dceea6638d8416e6 (diff)
downloadrneovim-0648100fed65cbe8efe774ae997ab841cae01872.tar.gz
rneovim-0648100fed65cbe8efe774ae997ab841cae01872.tar.bz2
rneovim-0648100fed65cbe8efe774ae997ab841cae01872.zip
refactor: convert macros to all-caps (#17895)
Closes https://github.com/neovim/neovim/issues/6297
-rw-r--r--src/nvim/ascii.h14
-rw-r--r--src/nvim/autocmd.c6
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/edit.c10
-rw-r--r--src/nvim/eval.c7
-rw-r--r--src/nvim/eval/encode.c4
-rw-r--r--src/nvim/eval/userfunc.c2
-rw-r--r--src/nvim/event/loop.h4
-rw-r--r--src/nvim/ex_cmds.c14
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c8
-rw-r--r--src/nvim/ex_eval.c5
-rw-r--r--src/nvim/file_search.c14
-rw-r--r--src/nvim/fileio.c6
-rw-r--r--src/nvim/garray.c2
-rw-r--r--src/nvim/hardcopy.c4
-rw-r--r--src/nvim/keymap.c2
-rw-r--r--src/nvim/macros.h6
-rw-r--r--src/nvim/mark.c72
-rw-r--r--src/nvim/memfile.c2
-rw-r--r--src/nvim/memline.c6
-rw-r--r--src/nvim/ops.c4
-rw-r--r--src/nvim/ops.h4
-rw-r--r--src/nvim/option.c38
-rw-r--r--src/nvim/os/env.c6
-rw-r--r--src/nvim/os/fs.c6
-rw-r--r--src/nvim/path.c18
-rw-r--r--src/nvim/search.c2
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/spellfile.c2
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/vim.h6
-rw-r--r--src/nvim/viml/parser/expressions.c6
34 files changed, 143 insertions, 147 deletions
diff --git a/src/nvim/ascii.h b/src/nvim/ascii.h
index 2cabaa43ef..692db40c0d 100644
--- a/src/nvim/ascii.h
+++ b/src/nvim/ascii.h
@@ -9,11 +9,11 @@
// Definitions of various common control characters.
-#define CharOrd(x) ((uint8_t)(x) < 'a' \
- ? (uint8_t)(x) - 'A' \
- : (uint8_t)(x) - 'a')
-#define CharOrdLow(x) ((uint8_t)(x) - 'a')
-#define CharOrdUp(x) ((uint8_t)(x) - 'A')
+#define CHAR_ORD(x) ((uint8_t)(x) < 'a' \
+ ? (uint8_t)(x) - 'A' \
+ : (uint8_t)(x) - 'a')
+#define CHAR_ORD_LOW(x) ((uint8_t)(x) - 'a')
+#define CHAR_ORD_UP(x) ((uint8_t)(x) - 'A')
#define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a))
#define NUL '\000'
@@ -35,8 +35,8 @@
#define POUND 0xA3
-#define Ctrl_chr(x) (TOUPPER_ASC(x) ^ 0x40) // '?' -> DEL, '@' -> ^@, etc.
-#define Meta(x) ((x) | 0x80)
+#define CTRL_CHR(x) (TOUPPER_ASC(x) ^ 0x40) // '?' -> DEL, '@' -> ^@, etc.
+#define META(x) ((x) | 0x80)
#define CTRL_F_STR "\006"
#define CTRL_H_STR "\010"
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 173f8e17af..3dc3d3d7a9 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -2359,7 +2359,7 @@ bool au_exists(const char *const arg) FUNC_ATTR_WARN_UNUSED_RESULT
}
// if pattern is "<buffer>", special handling is needed which uses curbuf
- // for pattern "<buffer=N>, fnamecmp() will work fine
+ // for pattern "<buffer=N>, FNAMECMP() will work fine
if (pattern != NULL && STRICMP(pattern, "<buffer>") == 0) {
buflocal_buf = curbuf;
}
@@ -2367,12 +2367,12 @@ bool au_exists(const char *const arg) FUNC_ATTR_WARN_UNUSED_RESULT
// Check if there is an autocommand with the given pattern.
for (; ap != NULL; ap = ap->next) {
// only use a pattern when it has not been removed and has commands.
- // For buffer-local autocommands, fnamecmp() works fine.
+ // For buffer-local autocommands, FNAMECMP() works fine.
if (ap->pat != NULL && ap->cmds != NULL
&& (group == AUGROUP_ALL || ap->group == group)
&& (pattern == NULL
|| (buflocal_buf == NULL
- ? fnamecmp(ap->pat, (char_u *)pattern) == 0
+ ? FNAMECMP(ap->pat, (char_u *)pattern) == 0
: ap->buflocal_nr == buflocal_buf->b_fnum))) {
retval = true;
break;
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 633575bce7..5d2d1cebde 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2955,7 +2955,7 @@ static bool otherfile_buf(buf_T *buf, char_u *ffname, FileID *file_id_p, bool fi
if (ffname == NULL || *ffname == NUL || buf->b_ffname == NULL) {
return true;
}
- if (fnamecmp(ffname, buf->b_ffname) == 0) {
+ if (FNAMECMP(ffname, buf->b_ffname) == 0) {
return false;
}
{
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 72a9220983..48436f1115 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -7529,7 +7529,7 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
// Does it look like a control character?
if (*look == '^' && look[1] >= '?' && look[1] <= '_') {
- if (try_match && keytyped == Ctrl_chr(look[1])) {
+ if (try_match && keytyped == CTRL_CHR(look[1])) {
return true;
}
look += 2;
@@ -7736,7 +7736,7 @@ int hkmap(int c)
};
if (c == 'N' || c == 'M' || c == 'P' || c == 'C' || c == 'Z') {
- return (int)(map[CharOrd(c)] - 1 + p_aleph);
+ return (int)(map[CHAR_ORD(c)] - 1 + p_aleph);
} else if (c == 'x') { // '-1'='sofit'
return 'X';
} else if (c == 'q') {
@@ -7752,7 +7752,7 @@ int hkmap(int c)
// do this the same was as 5.7 and previous, so it works correctly on
// all systems. Specifically, the e.g. Delete and Arrow keys are
// munged and won't work if e.g. searching for Hebrew text.
- return (int)(map[CharOrdLow(c)] + p_aleph);
+ return (int)(map[CHAR_ORD_LOW(c)] + p_aleph);
} else {
return c;
}
@@ -7782,12 +7782,12 @@ int hkmap(int c)
if (c < 'a' || c > 'z') {
return c;
}
- c = str[CharOrdLow(c)];
+ c = str[CHAR_ORD_LOW(c)];
break;
}
}
- return (int)(CharOrdLow(c) + p_aleph);
+ return (int)(CHAR_ORD_LOW(c) + p_aleph);
}
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index bebadc1282..e192a6de6b 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2720,7 +2720,7 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
if (cmdidx == CMD_let || cmdidx == CMD_const) {
xp->xp_context = EXPAND_USER_VARS;
- if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) {
+ if (strpbrk((char *)arg, "\"'+-*/%.=!?~|&$([<>,#") == NULL) {
// ":let var1 var2 ...": find last space.
for (p = arg + STRLEN(arg); p >= arg;) {
xp->xp_pattern = p;
@@ -2735,8 +2735,7 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
xp->xp_context = cmdidx == CMD_call ? EXPAND_FUNCTIONS
: EXPAND_EXPRESSION;
}
- while ((xp->xp_pattern = vim_strpbrk(arg,
- (char_u *)"\"'+-*/%.=!?~|&$([<>,#")) != NULL) {
+ while ((xp->xp_pattern = (char_u *)strpbrk((char *)arg, "\"'+-*/%.=!?~|&$([<>,#")) != NULL) {
c = *xp->xp_pattern;
if (c == '&') {
c = xp->xp_pattern[1];
@@ -10202,7 +10201,7 @@ repeat:
// Do not call shorten_fname() here since it removes the prefix
// even though the path does not have a prefix.
- if (fnamencmp(p, dirname, namelen) == 0) {
+ if (FNAMENCMP(p, dirname, namelen) == 0) {
p += namelen;
if (vim_ispathsep(*p)) {
while (*p && vim_ispathsep(*p)) {
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 6f4357421b..b04e3c04d6 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -29,8 +29,6 @@
#include "nvim/message.h"
#include "nvim/vim.h" // For _()
-#define utf_char2len(b) ((size_t)utf_char2len(b))
-
const char *const encode_bool_var_names[] = {
[kBoolVarTrue] = "true",
[kBoolVarFalse] = "false",
@@ -653,7 +651,7 @@ static inline int convert_to_json_string(garray_T *const gap, const char *const
ga_grow(gap, (int)str_len);
for (size_t i = 0; i < utf_len;) {
const int ch = utf_ptr2char((char_u *)utf_buf + i);
- const size_t shift = (ch == 0? 1: utf_char2len(ch));
+ const size_t shift = (ch == 0 ? 1 : ((size_t)utf_char2len(ch)));
assert(shift > 0);
// Is false on invalid unicode, but this should already be handled.
assert(ch == 0 || shift == ((size_t)utf_ptr2len((char_u *)utf_buf + i)));
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 0fadc0d220..340b731312 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -2503,7 +2503,7 @@ void ex_function(exarg_T *eap)
p = vim_strchr(scriptname, '/');
plen = (int)STRLEN(p);
slen = (int)STRLEN(sourcing_name);
- if (slen > plen && fnamecmp(p,
+ if (slen > plen && FNAMECMP(p,
sourcing_name + slen - plen) == 0) {
j = OK;
}
diff --git a/src/nvim/event/loop.h b/src/nvim/event/loop.h
index acd1d1a334..b3cd60f53d 100644
--- a/src/nvim/event/loop.h
+++ b/src/nvim/event/loop.h
@@ -10,8 +10,8 @@
typedef void *WatcherPtr;
-#define _noop(x)
-KLIST_INIT(WatcherPtr, WatcherPtr, _noop)
+#define _NOOP(x)
+KLIST_INIT(WatcherPtr, WatcherPtr, _NOOP)
typedef struct loop {
uv_loop_t uv;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 5e0dac5e55..d4c21bb33f 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -5343,8 +5343,8 @@ void fix_help_buffer(void)
* files. This uses the very first line in the help file.
*/
char_u *const fname = path_tail(curbuf->b_fname);
- if (fnamecmp(fname, "help.txt") == 0
- || (fnamencmp(fname, "help.", 5) == 0
+ if (FNAMECMP(fname, "help.txt") == 0
+ || (FNAMENCMP(fname, "help.", 5) == 0
&& ASCII_ISALPHA(fname[5])
&& ASCII_ISALPHA(fname[6])
&& TOLOWER_ASC(fname[7]) == 'x'
@@ -5402,18 +5402,18 @@ void fix_help_buffer(void)
if (e1 == NULL || e2 == NULL) {
continue;
}
- if (fnamecmp(e1, ".txt") != 0
- && fnamecmp(e1, fname + 4) != 0) {
+ if (FNAMECMP(e1, ".txt") != 0
+ && FNAMECMP(e1, fname + 4) != 0) {
// Not .txt and not .abx, remove it.
XFREE_CLEAR(fnames[i1]);
continue;
}
if (e1 - f1 != e2 - f2
- || fnamencmp(f1, f2, e1 - f1) != 0) {
+ || FNAMENCMP(f1, f2, e1 - f1) != 0) {
continue;
}
- if (fnamecmp(e1, ".txt") == 0
- && fnamecmp(e2, fname + 4) == 0) {
+ if (FNAMECMP(e1, ".txt") == 0
+ && FNAMECMP(e2, fname + 4) == 0) {
// use .abx instead of .txt
XFREE_CLEAR(fnames[i1]);
}
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 04fcb0304e..5af202c191 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2179,7 +2179,7 @@ scriptitem_T *get_current_script_id(char_u *fname, sctx_T *ret_sctx)
bool file_id_equal = file_id_ok && si->file_id_valid
&& os_fileid_equal(&(si->file_id), &file_id);
if (si->sn_name != NULL
- && (file_id_equal || fnamecmp(si->sn_name, fname) == 0)) {
+ && (file_id_equal || FNAMECMP(si->sn_name, fname) == 0)) {
break;
}
}
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 2c7dcffaf1..2311e80de4 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -44,8 +44,8 @@
#include "nvim/keymap.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h"
-#include "nvim/match.h"
#include "nvim/mark.h"
+#include "nvim/match.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
@@ -2663,9 +2663,9 @@ static char_u *find_command(exarg_T *eap, int *full)
// Use a precomputed index for fast look-up in cmdnames[]
// taking into account the first 2 letters of eap->cmd.
- eap->cmdidx = cmdidxs1[CharOrdLow(c1)];
+ eap->cmdidx = cmdidxs1[CHAR_ORD_LOW(c1)];
if (ASCII_ISLOWER(c2)) {
- eap->cmdidx += cmdidxs2[CharOrdLow(c1)][CharOrdLow(c2)];
+ eap->cmdidx += cmdidxs2[CHAR_ORD_LOW(c1)][CHAR_ORD_LOW(c2)];
}
} else {
eap->cmdidx = CMD_bang;
@@ -4519,7 +4519,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
if ((eap->usefilter
|| eap->cmdidx == CMD_bang
|| eap->cmdidx == CMD_terminal)
- && vim_strpbrk(repl, (char_u *)"!") != NULL) {
+ && strpbrk((char *)repl, "!") != NULL) {
char_u *l;
l = vim_strsave_escaped(repl, (char_u *)"!");
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 21e8a00d7d..102d817694 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -75,7 +75,10 @@
|| (cstack->cs_idx > 0 \
&& !(cstack->cs_flags[cstack->cs_idx - 1] & CSF_ACTIVE)))
-#define discard_pending_return(p) tv_free((typval_T *)(p))
+static void discard_pending_return(typval_T *p)
+{
+ tv_free(p);
+}
/*
* When several errors appear in a row, setting "force_abort" is delayed until
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index 15f1d3d065..8a09c10908 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -924,8 +924,8 @@ char_u *vim_findfile(void *search_ctx_arg)
*/
if (STRNCMP(stackp->ffs_wc_path, "**", 2) == 0) {
for (int i = stackp->ffs_filearray_cur;
- i < stackp->ffs_filearray_size; ++i) {
- if (fnamecmp(stackp->ffs_filearray[i],
+ i < stackp->ffs_filearray_size; i++) {
+ if (FNAMECMP(stackp->ffs_filearray[i],
stackp->ffs_fix_path) == 0) {
continue; // don't repush same directory
}
@@ -1050,7 +1050,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename,
if (*list_headp != NULL) {
retptr = *list_headp;
while (retptr != NULL) {
- if (fnamecmp(filename, retptr->ffvl_filename) == 0) {
+ if (FNAMECMP(filename, retptr->ffvl_filename) == 0) {
#ifdef FF_VERBOSE
if (p_verbose >= 5) {
verbose_enter_scroll();
@@ -1151,7 +1151,7 @@ static int ff_check_visited(ff_visited_T **visited_list, char_u *fname, char_u *
// check against list of already visited files
for (vp = *visited_list; vp != NULL; vp = vp->ffv_next) {
- if ((url && fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0)
+ if ((url && FNAMECMP(vp->ffv_fname, ff_expand_buffer) == 0)
|| (!url && vp->file_id_valid
&& os_fileid_equal(&(vp->file_id), &file_id))) {
// are the wildcard parts equal
@@ -1317,13 +1317,13 @@ static int ff_path_in_stoplist(char_u *path, int path_len, char_u **stopdirs_v)
* '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
* '/home/r' would also match '/home/rks'
*/
- if (fnamencmp(stopdirs_v[i], path, path_len) == 0
+ if (FNAMENCMP(stopdirs_v[i], path, path_len) == 0
&& vim_ispathsep(stopdirs_v[i][path_len])) {
return TRUE;
}
} else {
- if (fnamecmp(stopdirs_v[i], path) == 0) {
- return TRUE;
+ if (FNAMECMP(stopdirs_v[i], path) == 0) {
+ return true;
}
}
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index be66a6ce80..282e25e10e 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -2321,8 +2321,8 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
fname = sfname;
#endif
- if (buf->b_ffname != NULL && fnamecmp(ffname, buf->b_ffname) == 0) {
- overwriting = TRUE;
+ if (buf->b_ffname != NULL && FNAMECMP(ffname, buf->b_ffname) == 0) {
+ overwriting = true;
} else {
overwriting = FALSE;
}
@@ -4647,7 +4647,7 @@ int vim_rename(const char_u *from, const char_u *to)
* to the same file (ignoring case and slash/backslash differences) but
* the file name differs we need to go through a temp file.
*/
- if (fnamecmp(from, to) == 0) {
+ if (FNAMECMP(from, to) == 0) {
if (p_fic && (STRCMP(path_tail((char_u *)from), path_tail((char_u *)to))
!= 0)) {
use_tmp_file = true;
diff --git a/src/nvim/garray.c b/src/nvim/garray.c
index 7a3cc4a944..0c76e1a919 100644
--- a/src/nvim/garray.c
+++ b/src/nvim/garray.c
@@ -123,7 +123,7 @@ void ga_remove_duplicate_strings(garray_T *gap)
// loop over the growing array in reverse
for (int i = gap->ga_len - 1; i > 0; i--) {
- if (fnamecmp(fnames[i - 1], fnames[i]) == 0) {
+ if (FNAMECMP(fnames[i - 1], fnames[i]) == 0) {
xfree(fnames[i]);
// close the gap (move all strings one slot lower)
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 575b239f5a..8e03a8827c 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -1869,8 +1869,6 @@ static void prt_dsc_text(char *comment, char *text)
prt_write_file(prt_line_buffer);
}
-#define prt_dsc_atend(c) prt_dsc_text((c), "atend")
-
static void prt_dsc_ints(char *comment, int count, int *ints)
{
int i;
@@ -2534,7 +2532,7 @@ bool mch_print_begin(prt_settings_T *psettings)
prt_dsc_textline("CreationDate", p_time);
prt_dsc_textline("DocumentData", "Clean8Bit");
prt_dsc_textline("Orientation", "Portrait");
- prt_dsc_atend("Pages");
+ prt_dsc_text(("Pages"), "atend");
prt_dsc_textline("PageOrder", "Ascend");
// The bbox does not change with orientation - it is always in the default
// user coordinate system! We have to recalculate right and bottom
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index 1e305528ba..3fdc140ebd 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -775,7 +775,7 @@ static int extract_modifiers(int key, int *modp)
}
if ((modifiers & MOD_MASK_CTRL) && ((key >= '?' && key <= '_') || ASCII_ISALPHA(key))) {
key = TOUPPER_ASC(key);
- int new_key = Ctrl_chr(key);
+ int new_key = CTRL_CHR(key);
if (new_key != TAB && new_key != CAR && new_key != ESC) {
key = new_key;
modifiers &= ~MOD_MASK_CTRL;
diff --git a/src/nvim/macros.h b/src/nvim/macros.h
index be1ab935c0..0af7483154 100644
--- a/src/nvim/macros.h
+++ b/src/nvim/macros.h
@@ -83,11 +83,11 @@
// mch_open_rw(): invoke os_open() with third argument for user R/W.
#if defined(UNIX) // open in rw------- mode
-# define mch_open_rw(n, f) os_open((n), (f), (mode_t)0600)
+# define MCH_OPEN_RW(n, f) os_open((n), (f), (mode_t)0600)
#elif defined(WIN32)
-# define mch_open_rw(n, f) os_open((n), (f), S_IREAD | S_IWRITE)
+# define MCH_OPEN_RW(n, f) os_open((n), (f), S_IREAD | S_IWRITE)
#else
-# define mch_open_rw(n, f) os_open((n), (f), 0)
+# define MCH_OPEN_RW(n, f) os_open((n), (f), 0)
#endif
#define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 6790bf8240..0dbfb0c49f 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -551,7 +551,7 @@ static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf)
{
if (fm->fmark.fnum == 0
&& fm->fname != NULL
- && fnamecmp(name, fm->fname) == 0) {
+ && FNAMECMP(name, fm->fname) == 0) {
fm->fmark.fnum = buf->b_fnum;
XFREE_CLEAR(fm->fname);
}
@@ -923,7 +923,7 @@ void ex_changes(exarg_T *eap)
}
}
-#define one_adjust(add) \
+#define ONE_ADJUST(add) \
{ \
lp = add; \
if (*lp >= line1 && *lp <= line2) \
@@ -938,7 +938,7 @@ void ex_changes(exarg_T *eap)
}
// don't delete the line, just put at first deleted line
-#define one_adjust_nodel(add) \
+#define ONE_ADJUST_NODEL(add) \
{ \
lp = add; \
if (*lp >= line1 && *lp <= line2) \
@@ -994,37 +994,37 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, lo
if (!cmdmod.lockmarks) {
// named marks, lower case and upper case
for (i = 0; i < NMARKS; i++) {
- one_adjust(&(curbuf->b_namedm[i].mark.lnum));
+ ONE_ADJUST(&(curbuf->b_namedm[i].mark.lnum));
if (namedfm[i].fmark.fnum == fnum) {
- one_adjust_nodel(&(namedfm[i].fmark.mark.lnum));
+ ONE_ADJUST_NODEL(&(namedfm[i].fmark.mark.lnum));
}
}
for (i = NMARKS; i < NGLOBALMARKS; i++) {
if (namedfm[i].fmark.fnum == fnum) {
- one_adjust_nodel(&(namedfm[i].fmark.mark.lnum));
+ ONE_ADJUST_NODEL(&(namedfm[i].fmark.mark.lnum));
}
}
// last Insert position
- one_adjust(&(curbuf->b_last_insert.mark.lnum));
+ ONE_ADJUST(&(curbuf->b_last_insert.mark.lnum));
// last change position
- one_adjust(&(curbuf->b_last_change.mark.lnum));
+ ONE_ADJUST(&(curbuf->b_last_change.mark.lnum));
// last cursor position, if it was set
if (!equalpos(curbuf->b_last_cursor.mark, initpos)) {
- one_adjust(&(curbuf->b_last_cursor.mark.lnum));
+ ONE_ADJUST(&(curbuf->b_last_cursor.mark.lnum));
}
// list of change positions
- for (i = 0; i < curbuf->b_changelistlen; ++i) {
- one_adjust_nodel(&(curbuf->b_changelist[i].mark.lnum));
+ for (i = 0; i < curbuf->b_changelistlen; i++) {
+ ONE_ADJUST_NODEL(&(curbuf->b_changelist[i].mark.lnum));
}
// Visual area
- one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum));
- one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum));
+ ONE_ADJUST_NODEL(&(curbuf->b_visual.vi_start.lnum));
+ ONE_ADJUST_NODEL(&(curbuf->b_visual.vi_end.lnum));
// quickfix marks
if (!qf_mark_adjust(NULL, line1, line2, amount, amount_after)) {
@@ -1047,14 +1047,14 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, lo
}
// previous context mark
- one_adjust(&(curwin->w_pcmark.lnum));
+ ONE_ADJUST(&(curwin->w_pcmark.lnum));
// previous pcmark
- one_adjust(&(curwin->w_prev_pcmark.lnum));
+ ONE_ADJUST(&(curwin->w_prev_pcmark.lnum));
// saved cursor for formatting
if (saved_cursor.lnum != 0) {
- one_adjust_nodel(&(saved_cursor.lnum));
+ ONE_ADJUST_NODEL(&(saved_cursor.lnum));
}
/*
@@ -1066,7 +1066,7 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, lo
// duplicate marks in the jumplist, they will be removed later.
for (i = 0; i < win->w_jumplistlen; i++) {
if (win->w_jumplist[i].fmark.fnum == fnum) {
- one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum));
+ ONE_ADJUST_NODEL(&(win->w_jumplist[i].fmark.mark.lnum));
}
}
}
@@ -1076,15 +1076,15 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, lo
// marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++) {
if (win->w_tagstack[i].fmark.fnum == fnum) {
- one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum));
+ ONE_ADJUST_NODEL(&(win->w_tagstack[i].fmark.mark.lnum));
}
}
}
// the displayed Visual area
if (win->w_old_cursor_lnum != 0) {
- one_adjust_nodel(&(win->w_old_cursor_lnum));
- one_adjust_nodel(&(win->w_old_visual_lnum));
+ ONE_ADJUST_NODEL(&(win->w_old_cursor_lnum));
+ ONE_ADJUST_NODEL(&(win->w_old_visual_lnum));
}
// topline and cursor position for windows with the same buffer
@@ -1132,7 +1132,7 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, lo
}
// This code is used often, needs to be fast.
-#define col_adjust(pp) \
+#define COL_ADJUST(pp) \
{ \
posp = pp; \
if (posp->lnum == lnum && posp->col >= mincol) \
@@ -1166,40 +1166,40 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_a
}
// named marks, lower case and upper case
for (i = 0; i < NMARKS; i++) {
- col_adjust(&(curbuf->b_namedm[i].mark));
+ COL_ADJUST(&(curbuf->b_namedm[i].mark));
if (namedfm[i].fmark.fnum == fnum) {
- col_adjust(&(namedfm[i].fmark.mark));
+ COL_ADJUST(&(namedfm[i].fmark.mark));
}
}
for (i = NMARKS; i < NGLOBALMARKS; i++) {
if (namedfm[i].fmark.fnum == fnum) {
- col_adjust(&(namedfm[i].fmark.mark));
+ COL_ADJUST(&(namedfm[i].fmark.mark));
}
}
// last Insert position
- col_adjust(&(curbuf->b_last_insert.mark));
+ COL_ADJUST(&(curbuf->b_last_insert.mark));
// last change position
- col_adjust(&(curbuf->b_last_change.mark));
+ COL_ADJUST(&(curbuf->b_last_change.mark));
// list of change positions
- for (i = 0; i < curbuf->b_changelistlen; ++i) {
- col_adjust(&(curbuf->b_changelist[i].mark));
+ for (i = 0; i < curbuf->b_changelistlen; i++) {
+ COL_ADJUST(&(curbuf->b_changelist[i].mark));
}
// Visual area
- col_adjust(&(curbuf->b_visual.vi_start));
- col_adjust(&(curbuf->b_visual.vi_end));
+ COL_ADJUST(&(curbuf->b_visual.vi_start));
+ COL_ADJUST(&(curbuf->b_visual.vi_end));
// previous context mark
- col_adjust(&(curwin->w_pcmark));
+ COL_ADJUST(&(curwin->w_pcmark));
// previous pcmark
- col_adjust(&(curwin->w_prev_pcmark));
+ COL_ADJUST(&(curwin->w_prev_pcmark));
// saved cursor for formatting
- col_adjust(&saved_cursor);
+ COL_ADJUST(&saved_cursor);
/*
* Adjust items in all windows related to the current buffer.
@@ -1208,7 +1208,7 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_a
// marks in the jumplist
for (i = 0; i < win->w_jumplistlen; ++i) {
if (win->w_jumplist[i].fmark.fnum == fnum) {
- col_adjust(&(win->w_jumplist[i].fmark.mark));
+ COL_ADJUST(&(win->w_jumplist[i].fmark.mark));
}
}
@@ -1216,13 +1216,13 @@ void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_a
// marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++) {
if (win->w_tagstack[i].fmark.fnum == fnum) {
- col_adjust(&(win->w_tagstack[i].fmark.mark));
+ COL_ADJUST(&(win->w_tagstack[i].fmark.mark));
}
}
// cursor position for other windows with the same buffer
if (win != curwin) {
- col_adjust(&win->w_cursor);
+ COL_ADJUST(&win->w_cursor);
}
}
}
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 2a72d1e6a0..28337803ac 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -795,7 +795,7 @@ static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags)
emsg(_("E300: Swap file already exists (symlink attack?)"));
} else {
// try to open the file
- mfp->mf_fd = mch_open_rw((char *)mfp->mf_fname, flags | O_NOFOLLOW);
+ mfp->mf_fd = MCH_OPEN_RW((char *)mfp->mf_fname, flags | O_NOFOLLOW);
}
// If the file cannot be opened, use memory only
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 55480ab384..5646b2db15 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -418,7 +418,7 @@ void ml_setname(buf_T *buf)
}
// if the file name is the same we don't have to do anything
- if (fnamecmp(fname, mfp->mf_fname) == 0) {
+ if (FNAMECMP(fname, mfp->mf_fname) == 0) {
xfree(fname);
success = true;
break;
@@ -3459,7 +3459,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
}
// A file name equal to old_fname is OK to use.
- if (old_fname != NULL && fnamecmp(fname, old_fname) == 0) {
+ if (old_fname != NULL && FNAMECMP(fname, old_fname) == 0) {
break;
}
@@ -3484,7 +3484,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// buffer don't compare the directory names, they can
// have a different mountpoint.
if (b0.b0_flags & B0_SAME_DIR) {
- if (fnamecmp(path_tail(buf->b_ffname),
+ if (FNAMECMP(path_tail(buf->b_ffname),
path_tail(b0.b0_fname)) != 0
|| !same_directory((char_u *)fname, buf->b_ffname)) {
// Symlinks may point to the same file even
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 36c2513810..d6550f38fa 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5146,7 +5146,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
if (do_alpha && ASCII_ISALPHA(firstdigit)) {
// decrement or increment alphabetic character
if (op_type == OP_NR_SUB) {
- if (CharOrd(firstdigit) < Prenum1) {
+ if (CHAR_ORD(firstdigit) < Prenum1) {
if (isupper(firstdigit)) {
firstdigit = 'A';
} else {
@@ -5156,7 +5156,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
firstdigit -= (int)Prenum1;
}
} else {
- if (26 - CharOrd(firstdigit) - 1 < Prenum1) {
+ if (26 - CHAR_ORD(firstdigit) - 1 < Prenum1) {
if (isupper(firstdigit)) {
firstdigit = 'Z';
} else {
diff --git a/src/nvim/ops.h b/src/nvim/ops.h
index efde7290cf..8133dc0b1f 100644
--- a/src/nvim/ops.h
+++ b/src/nvim/ops.h
@@ -108,9 +108,9 @@ static inline int op_reg_index(const int regname)
if (ascii_isdigit(regname)) {
return regname - '0';
} else if (ASCII_ISLOWER(regname)) {
- return CharOrdLow(regname) + 10;
+ return CHAR_ORD_LOW(regname) + 10;
} else if (ASCII_ISUPPER(regname)) {
- return CharOrdUp(regname) + 10;
+ return CHAR_ORD_UP(regname) + 10;
} else if (regname == '-') {
return DELETION_REGISTER;
} else if (regname == '*') {
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 37594340de..49c76d2452 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -832,8 +832,8 @@ void set_init_3(void)
// Default for p_sp is "| tee", for p_srr is ">".
// For known shells it is changed here to include stderr.
//
- if (fnamecmp(p, "csh") == 0
- || fnamecmp(p, "tcsh") == 0) {
+ if (FNAMECMP(p, "csh") == 0
+ || FNAMECMP(p, "tcsh") == 0) {
if (do_sp) {
p_sp = (char_u *)"|& tee";
options[idx_sp].def_val = p_sp;
@@ -842,16 +842,16 @@ void set_init_3(void)
p_srr = (char_u *)">&";
options[idx_srr].def_val = p_srr;
}
- } else if (fnamecmp(p, "sh") == 0
- || fnamecmp(p, "ksh") == 0
- || fnamecmp(p, "mksh") == 0
- || fnamecmp(p, "pdksh") == 0
- || fnamecmp(p, "zsh") == 0
- || fnamecmp(p, "zsh-beta") == 0
- || fnamecmp(p, "bash") == 0
- || fnamecmp(p, "fish") == 0
- || fnamecmp(p, "ash") == 0
- || fnamecmp(p, "dash") == 0) {
+ } else if (FNAMECMP(p, "sh") == 0
+ || FNAMECMP(p, "ksh") == 0
+ || FNAMECMP(p, "mksh") == 0
+ || FNAMECMP(p, "pdksh") == 0
+ || FNAMECMP(p, "zsh") == 0
+ || FNAMECMP(p, "zsh-beta") == 0
+ || FNAMECMP(p, "bash") == 0
+ || FNAMECMP(p, "fish") == 0
+ || FNAMECMP(p, "ash") == 0
+ || FNAMECMP(p, "dash") == 0) {
// Always use POSIX shell style redirection if we reach this
if (do_sp) {
p_sp = (char_u *)"2>&1| tee";
@@ -1799,7 +1799,7 @@ static int string_to_key(char_u *arg)
return find_key_option(arg + 1, true);
}
if (*arg == '^') {
- return Ctrl_chr(arg[1]);
+ return CTRL_CHR(arg[1]);
}
return *arg;
}
@@ -2392,10 +2392,10 @@ static char *did_set_string_option(int opt_idx, char_u **varp, bool new_value_al
&& (options[opt_idx].flags & P_SECURE)) {
errmsg = e_secure;
} else if (((options[opt_idx].flags & P_NFNAME)
- && vim_strpbrk(*varp, (char_u *)(secure ? "/\\*?[|;&<>\r\n"
- : "/\\*?[<>\r\n")) != NULL)
+ && strpbrk((char *)(*varp),
+ (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
|| ((options[opt_idx].flags & P_NDNAME)
- && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)) {
+ && strpbrk((char *)(*varp), "*?[|;&<>\r\n") != NULL)) {
// Check for a "normal" directory or file name in some options. Disallow a
// path separator (slash and/or backslash), wildcards and characters that
// are often illegal in a file name. Be more permissive if "secure" is off.
@@ -4799,7 +4799,7 @@ int findoption_len(const char *const arg, const size_t len)
if (s[0] == 't' && s[1] == '_') {
quick_tab[26] = i;
} else {
- quick_tab[CharOrdLow(s[0])] = i;
+ quick_tab[CHAR_ORD_LOW(s[0])] = i;
}
}
p = s;
@@ -4816,7 +4816,7 @@ int findoption_len(const char *const arg, const size_t len)
if (is_term_opt) {
opt_idx = quick_tab[26];
} else {
- opt_idx = quick_tab[CharOrdLow(arg[0])];
+ opt_idx = quick_tab[CHAR_ORD_LOW(arg[0])];
}
// Match full name
for (; (s = options[opt_idx].fullname) != NULL; opt_idx++) {
@@ -4825,7 +4825,7 @@ int findoption_len(const char *const arg, const size_t len)
}
}
if (s == NULL && !is_term_opt) {
- opt_idx = quick_tab[CharOrdLow(arg[0])];
+ opt_idx = quick_tab[CHAR_ORD_LOW(arg[0])];
// Match short name
for (; options[opt_idx].fullname != NULL; opt_idx++) {
s = options[opt_idx].shortname;
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index e958a39ad2..bf9e455c38 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -698,7 +698,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
// If "var" contains white space, escape it with a backslash.
// Required for ":e ~/tt" when $HOME includes a space.
- if (esc && var != NULL && vim_strpbrk(var, (char_u *)" \t") != NULL) {
+ if (esc && var != NULL && strpbrk((char *)var, " \t") != NULL) {
char_u *p = vim_strsave_escaped(var, (char_u *)" \t");
if (mustfree) {
@@ -805,7 +805,7 @@ static char *remove_tail(char *path, char *pend, char *dirname)
char *new_tail = pend - len - 1;
if (new_tail >= path
- && fnamencmp((char_u *)new_tail, (char_u *)dirname, len) == 0
+ && FNAMENCMP((char_u *)new_tail, (char_u *)dirname, len) == 0
&& (new_tail == path || after_pathsep(path, new_tail))) {
return new_tail;
}
@@ -1102,7 +1102,7 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
size_t len = dirlen;
for (;;) {
if (len
- && fnamencmp(src, (char_u *)p, len) == 0
+ && FNAMENCMP(src, (char_u *)p, len) == 0
&& (vim_ispathsep(src[len])
|| (!one && (src[len] == ',' || src[len] == ' '))
|| src[len] == NUL)) {
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index daf974ee74..5fcae79a67 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -1293,7 +1293,7 @@ shortcut_end:
return rfname;
}
-# define is_path_sep(c) ((c) == L'\\' || (c) == L'/')
+# define IS_PATH_SEP(c) ((c) == L'\\' || (c) == L'/')
/// Returns true if the path contains a reparse point (junction or symbolic
/// link). Otherwise false in returned.
bool os_is_reparse_point_include(const char *path)
@@ -1310,9 +1310,9 @@ bool os_is_reparse_point_include(const char *path)
}
p = utf16_path;
- if (isalpha(p[0]) && p[1] == L':' && is_path_sep(p[2])) {
+ if (isalpha(p[0]) && p[1] == L':' && IS_PATH_SEP(p[2])) {
p += 3;
- } else if (is_path_sep(p[0]) && is_path_sep(p[1])) {
+ } else if (IS_PATH_SEP(p[0]) && IS_PATH_SEP(p[1])) {
p += 2;
}
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 75624778e3..66cfb3b31a 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -71,9 +71,9 @@ FileComparison path_full_compare(char_u *const s1, char_u *const s2, const bool
if (!id_ok_1 && !id_ok_2) {
// If os_fileid() doesn't work, may compare the names.
if (checkname) {
- vim_FullName((char *)exp1, (char *)full1, MAXPATHL, FALSE);
- vim_FullName((char *)s2, (char *)full2, MAXPATHL, FALSE);
- if (fnamecmp(full1, full2) == 0) {
+ vim_FullName((char *)exp1, (char *)full1, MAXPATHL, false);
+ vim_FullName((char *)s2, (char *)full2, MAXPATHL, false);
+ if (FNAMECMP(full1, full2) == 0) {
return kEqualFileNames;
}
}
@@ -728,7 +728,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
&& (name[1] != '.' || name[2] != NUL))) // -V557
&& ((regmatch.regprog != NULL && vim_regexec(&regmatch, name, 0))
|| ((flags & EW_NOTWILD)
- && fnamencmp(path + (s - buf), name, e - s) == 0))) {
+ && FNAMENCMP(path + (s - buf), name, e - s) == 0))) {
STRCPY(s, name);
len = STRLEN(buf);
@@ -817,7 +817,7 @@ static bool is_unique(char_u *maybe_unique, garray_T *gap, int i)
continue; // it's different when it's shorter
}
char_u *rival = other_paths[j] + other_path_len - candidate_len;
- if (fnamecmp(maybe_unique, rival) == 0
+ if (FNAMECMP(maybe_unique, rival) == 0
&& (rival == other_paths[j] || vim_ispathsep(*(rival - 1)))) {
return false; // match
}
@@ -976,7 +976,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
char_u *path_cutoff;
len = STRLEN(path);
- is_in_curdir = fnamencmp(curdir, path, dir_end - path) == 0
+ is_in_curdir = FNAMENCMP(curdir, path, dir_end - path) == 0
&& curdir[dir_end - path] == NUL;
if (is_in_curdir) {
in_curdir[i] = vim_strsave(path);
@@ -1473,7 +1473,7 @@ void addfile(garray_T *gap, char_u *f, int flags)
#ifdef FNAME_ILLEGAL
// if the file/dir contains illegal characters, don't add it
- if (vim_strpbrk(f, (char_u *)FNAME_ILLEGAL) != NULL) {
+ if (strpbrk((char *)f, FNAME_ILLEGAL) != NULL) {
return;
}
#endif
@@ -2090,7 +2090,7 @@ char_u *path_shorten_fname(char_u *full_path, char_u *dir_name)
// If full_path and dir_name do not match, it's impossible to make one
// relative to the other.
- if (fnamencmp(dir_name, full_path, len) != 0) {
+ if (FNAMENCMP(dir_name, full_path, len) != 0) {
return NULL;
}
@@ -2254,7 +2254,7 @@ int match_suffix(char_u *fname)
}
} else {
if (fnamelen >= setsuflen
- && fnamencmp(suf_buf, fname + fnamelen - setsuflen, setsuflen) == 0) {
+ && FNAMENCMP(suf_buf, fname + fnamelen - setsuflen, setsuflen) == 0) {
break;
}
setsuflen = 0;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index c30e69391f..0d4ab8d63c 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -2324,7 +2324,7 @@ int check_linecomment(const char_u *line)
if (vim_strchr(p, ';') != NULL) { // there may be comments
bool in_str = false; // inside of string
- while ((p = vim_strpbrk(p, (char_u *)"\";")) != NULL) {
+ while ((p = (char_u *)strpbrk((char *)p, "\";")) != NULL) {
if (*p == '"') {
if (in_str) {
if (*(p - 1) != '\\') { // skip escaped quote
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 6c0add87d3..76bf81ffbf 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -1053,7 +1053,7 @@ static buf_T *find_buffer(khash_t(fnamebufs) *const fname_bufs, const char *cons
kh_key(fname_bufs, k) = xstrdup(fname);
FOR_ALL_BUFFERS(buf) {
if (buf->b_ffname != NULL) {
- if (fnamecmp(fname, buf->b_ffname) == 0) {
+ if (FNAMECMP(fname, buf->b_ffname) == 0) {
kh_val(fname_bufs, k) = buf;
return buf;
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 9fa594bc96..20e1fefbb4 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -2101,7 +2101,7 @@ char *did_set_spelllang(win_T *wp)
// If the name ends in ".spl" use it as the name of the spell file.
// If there is a region name let "region" point to it and remove it
// from the name.
- if (len > 4 && fnamecmp(lang + len - 4, ".spl") == 0) {
+ if (len > 4 && FNAMECMP(lang + len - 4, ".spl") == 0) {
filename = true;
// Locate a region and remove it from the file name.
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 3d3e6e728c..0933e6d467 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -893,7 +893,7 @@ void suggest_load_files(void)
slang->sl_sugloaded = true;
dotp = STRRCHR(slang->sl_fname, '.');
- if (dotp == NULL || fnamecmp(dotp, ".spl") != 0) {
+ if (dotp == NULL || FNAMECMP(dotp, ".spl") != 0) {
continue;
}
STRCPY(dotp, ".sug");
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 0ceb66f438..76bb5a0186 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5376,7 +5376,7 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
/*
* Handle full group name.
*/
- if (vim_strpbrk(name + 1, (char_u *)"\\.*^$~[") == NULL) {
+ if (strpbrk((char *)name + 1, "\\.*^$~[") == NULL) {
id = syn_check_group((char *)(name + 1), (int)(end - p));
} else {
// Handle match of regexp with group names.
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 64333e9c3d..3c8a865fb1 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -253,8 +253,6 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
#define STRNCAT(d, s, n) strncat((char *)(d), (char *)(s), (size_t)(n))
#define STRLCAT(d, s, n) xstrlcat((char *)(d), (char *)(s), (size_t)(n))
-#define vim_strpbrk(s, cs) (char_u *)strpbrk((char *)(s), (char *)(cs))
-
// Character used as separated in autoload function/variable names.
#define AUTOLOAD_CHAR '#'
@@ -280,8 +278,8 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
/// @param[in] y Second file name to compare.
///
/// @return 0 for equal file names, non-zero otherwise.
-#define fnamecmp(x, y) path_fnamecmp((const char *)(x), (const char *)(y))
-#define fnamencmp(x, y, n) path_fnamencmp((const char *)(x), \
+#define FNAMECMP(x, y) path_fnamecmp((const char *)(x), (const char *)(y))
+#define FNAMENCMP(x, y, n) path_fnamencmp((const char *)(x), \
(const char *)(y), \
(size_t)(n))
diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c
index 9d1318724e..b8b0a38f44 100644
--- a/src/nvim/viml/parser/expressions.c
+++ b/src/nvim/viml/parser/expressions.c
@@ -66,7 +66,7 @@
#include "nvim/viml/parser/expressions.h"
#include "nvim/viml/parser/parser.h"
-#define vim_str2nr(s, ...) vim_str2nr((const char_u *)(s), __VA_ARGS__)
+#define VIM_STR2NR(s, ...) vim_str2nr((const char_u *)(s), __VA_ARGS__)
typedef kvec_withinit_t(ExprASTNode **, 16) ExprASTStack;
@@ -371,7 +371,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags)
significand_part = significand_part * 10 + (pline.data[i] - '0');
}
if (exp_start) {
- vim_str2nr(pline.data + exp_start, NULL, NULL, 0, NULL, &exp_part,
+ VIM_STR2NR(pline.data + exp_start, NULL, NULL, 0, NULL, &exp_part,
(int)(ret.len - exp_start), false);
}
if (exp_negative) {
@@ -389,7 +389,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags)
} else {
int len;
int prep;
- vim_str2nr(pline.data, &prep, &len, STR2NR_ALL, NULL,
+ VIM_STR2NR(pline.data, &prep, &len, STR2NR_ALL, NULL,
&ret.data.num.val.integer, (int)pline.size, false);
ret.len = (size_t)len;
const uint8_t bases[] = {