diff options
| author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2022-04-25 04:18:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-24 20:18:43 -0600 |
| commit | 0648100fed65cbe8efe774ae997ab841cae01872 (patch) | |
| tree | 4b2b5a41f58ddf442a69726f6a315c393317714b /src/nvim | |
| parent | 7813fa2f8cc3885788abc5c5dceea6638d8416e6 (diff) | |
| download | rneovim-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
Diffstat (limited to 'src/nvim')
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) { |