aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-11 11:20:08 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-11 13:31:17 +0100
commit8e58d37f2e15ac8540377148e55ed08a039aadb6 (patch)
tree799dd1f30d375ac8cdeae196fceec9d2ad0f134a /src
parentc4ad15ae324f6460c683a64c44d65e693e1f39bb (diff)
downloadrneovim-8e58d37f2e15ac8540377148e55ed08a039aadb6.tar.gz
rneovim-8e58d37f2e15ac8540377148e55ed08a039aadb6.tar.bz2
rneovim-8e58d37f2e15ac8540377148e55ed08a039aadb6.zip
refactor: remove redundant casts
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/arglist.c2
-rw-r--r--src/nvim/autocmd.c2
-rw-r--r--src/nvim/buffer.c24
-rw-r--r--src/nvim/buffer.h2
-rw-r--r--src/nvim/change.c4
-rw-r--r--src/nvim/cmdexpand.c4
-rw-r--r--src/nvim/cmdhist.c2
-rw-r--r--src/nvim/debugger.c8
-rw-r--r--src/nvim/diff.c10
-rw-r--r--src/nvim/eval.c4
-rw-r--r--src/nvim/eval/userfunc.c2
-rw-r--r--src/nvim/ex_cmds.c16
-rw-r--r--src/nvim/ex_cmds.h6
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c14
-rw-r--r--src/nvim/ex_eval.c2
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/fileio.c10
-rw-r--r--src/nvim/fold.c32
-rw-r--r--src/nvim/hashtab.c2
-rw-r--r--src/nvim/help.c2
-rw-r--r--src/nvim/indent.c2
-rw-r--r--src/nvim/main.c2
-rw-r--r--src/nvim/mapping.c4
-rw-r--r--src/nvim/mark.c2
-rw-r--r--src/nvim/memline.c25
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/ops.c15
-rw-r--r--src/nvim/option.c6
-rw-r--r--src/nvim/optionstr.c2
-rw-r--r--src/nvim/path.c4
-rw-r--r--src/nvim/popupmenu.c2
-rw-r--r--src/nvim/quickfix.c26
-rw-r--r--src/nvim/regexp.c6
-rw-r--r--src/nvim/runtime.c4
-rw-r--r--src/nvim/search.c4
-rw-r--r--src/nvim/sign.c2
-rw-r--r--src/nvim/spell.c6
-rw-r--r--src/nvim/spellfile.c8
-rw-r--r--src/nvim/syntax.c4
-rw-r--r--src/nvim/tag.c6
-rw-r--r--src/nvim/textobject.c4
-rw-r--r--src/nvim/undo.c6
-rw-r--r--src/nvim/window.c2
45 files changed, 146 insertions, 152 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 8446f5b383..86e542a1c7 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -923,7 +923,7 @@ Buffer nvim_create_buf(Boolean listed, Boolean scratch, Error *err)
FUNC_API_SINCE(6)
{
try_start();
- buf_T *buf = buflist_new(NULL, NULL, (linenr_T)0,
+ buf_T *buf = buflist_new(NULL, NULL, 0,
BLN_NOOPT | BLN_NEW | (listed ? BLN_LISTED : 0));
try_end(err);
if (buf == NULL) {
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index bcf343a5b4..c30734de74 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -393,7 +393,7 @@ static void arglist_del_files(garray_T *alist_ga)
bool didone = false;
for (int match = 0; match < ARGCOUNT; match++) {
- if (vim_regexec(&regmatch, alist_name(&ARGLIST[match]), (colnr_T)0)) {
+ if (vim_regexec(&regmatch, alist_name(&ARGLIST[match]), 0)) {
didone = true;
xfree(ARGLIST[match].ae_fname);
memmove(ARGLIST + match, ARGLIST + match + 1,
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 1a83dd30c0..b58b5784b4 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -2594,7 +2594,7 @@ void do_autocmd_uienter(uint64_t chanid, bool attached)
void do_autocmd_focusgained(bool gained)
{
static bool recursive = false;
- static Timestamp last_time = (time_t)0;
+ static Timestamp last_time = 0;
if (recursive) {
return; // disallow recursion
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 86b16c18da..4ce4036ac9 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -146,12 +146,12 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags)
line_count = curbuf->b_ml.ml_line_count;
retval = readfile(read_stdin ? NULL : curbuf->b_ffname,
read_stdin ? NULL : curbuf->b_fname,
- line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap,
+ line_count, 0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER, silent);
if (retval == OK) {
// Delete the binary lines.
while (--line_count >= 0) {
- ml_delete((linenr_T)1, false);
+ ml_delete(1, false);
}
} else {
// Delete the converted lines.
@@ -294,7 +294,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg)
#endif
retval = readfile(curbuf->b_ffname, curbuf->b_fname,
- (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap,
+ 0, 0, (linenr_T)MAXLNUM, eap,
flags | READ_NEW | (read_fifo ? READ_FIFO : 0), silent);
#ifdef UNIX
if (read_fifo) {
@@ -317,8 +317,8 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg)
// it possible to retry when 'fileformat' or 'fileencoding' was
// guessed wrong.
curbuf->b_p_bin = true;
- retval = readfile(NULL, NULL, (linenr_T)0,
- (linenr_T)0, (linenr_T)MAXLNUM, NULL,
+ retval = readfile(NULL, NULL, 0,
+ 0, (linenr_T)MAXLNUM, NULL,
flags | (READ_NEW + READ_STDIN), silent);
curbuf->b_p_bin = save_bin;
if (retval == OK) {
@@ -753,7 +753,7 @@ void buf_clear(void)
linenr_T line_count = curbuf->b_ml.ml_line_count;
extmark_free_all(curbuf); // delete any extmarks
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
- ml_delete((linenr_T)1, false);
+ ml_delete(1, false);
}
deleted_lines_mark(1, line_count); // prepare for display
}
@@ -1801,7 +1801,7 @@ buf_T *buflist_new(char *ffname_arg, char *sfname_arg, linenr_T lnum, int flags)
xfree(ffname);
if (lnum != 0) {
buflist_setfpos(buf, (flags & BLN_NOCURWIN) ? NULL : curwin,
- lnum, (colnr_T)0, false);
+ lnum, 0, false);
}
if ((flags & BLN_NOOPT) == 0) {
// Copy the options now, if 'cpo' doesn't have 's' and not done already.
@@ -2532,12 +2532,12 @@ static char *fname_match(regmatch_T *rmp, char *name, bool ignore_case)
// Ignore case when 'fileignorecase' or the argument is set.
rmp->rm_ic = p_fic || ignore_case;
- if (vim_regexec(rmp, name, (colnr_T)0)) {
+ if (vim_regexec(rmp, name, 0)) {
match = name;
} else if (rmp->regprog != NULL) {
// Replace $(HOME) with '~' and try matching again.
p = home_replace_save(NULL, name);
- if (vim_regexec(rmp, p, (colnr_T)0)) {
+ if (vim_regexec(rmp, p, 0)) {
match = name;
}
xfree(p);
@@ -3035,7 +3035,7 @@ char *getaltfname(bool errmsg)
/// Used by qf_init(), main() and doarglist()
int buflist_add(char *fname, int flags)
{
- buf_T *buf = buflist_new(fname, NULL, (linenr_T)0, flags);
+ buf_T *buf = buflist_new(fname, NULL, 0, flags);
if (buf != NULL) {
return buf->b_fnum;
}
@@ -4231,7 +4231,7 @@ bool buf_contents_changed(buf_T *buf)
bool differ = true;
// Allocate a buffer without putting it in the buffer list.
- buf_T *newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
+ buf_T *newbuf = buflist_new(NULL, NULL, 1, BLN_DUMMY);
if (newbuf == NULL) {
return true;
}
@@ -4246,7 +4246,7 @@ bool buf_contents_changed(buf_T *buf)
if (ml_open(curbuf) == OK
&& readfile(buf->b_ffname, buf->b_fname,
- (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM,
+ 0, 0, (linenr_T)MAXLNUM,
&ea, READ_NEW | READ_DUMMY, false) == OK) {
// compare the two files line by line
if (buf->b_ml.ml_line_count == curbuf->b_ml.ml_line_count) {
diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h
index 2351ddc61b..2b0e6b2525 100644
--- a/src/nvim/buffer.h
+++ b/src/nvim/buffer.h
@@ -138,7 +138,7 @@ static inline void buf_inc_changedtick(buf_T *const buf)
static inline bool buf_is_empty(buf_T *buf)
{
return buf->b_ml.ml_line_count == 1
- && *ml_get_buf(buf, (linenr_T)1) == '\0';
+ && *ml_get_buf(buf, 1) == '\0';
}
#endif // NVIM_BUFFER_H
diff --git a/src/nvim/change.c b/src/nvim/change.c
index a2657b86aa..39229e1cf0 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -623,7 +623,7 @@ bool file_ff_differs(buf_T *buf, bool ignore_empty)
if (ignore_empty
&& (buf->b_flags & BF_NEW)
&& buf->b_ml.ml_line_count == 1
- && *ml_get_buf(buf, (linenr_T)1) == NUL) {
+ && *ml_get_buf(buf, 1) == NUL) {
return false;
}
if (buf->b_start_ffc != *buf->b_p_ff) {
@@ -1726,7 +1726,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
curwin->w_cursor.lnum--;
}
if ((State & VREPLACE_FLAG) == 0 || old_cursor.lnum >= orig_line_count) {
- if (ml_append(curwin->w_cursor.lnum, p_extra, (colnr_T)0, false) == FAIL) {
+ if (ml_append(curwin->w_cursor.lnum, p_extra, 0, false) == FAIL) {
goto theend;
}
// Postpone calling changed_lines(), because it would mess up folding
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 51675b81bc..23948e16bb 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -2855,7 +2855,7 @@ void ExpandGeneric(const char *const pat, expand_T *xp, regmatch_T *regmatch, ch
int score = 0;
if (xp->xp_pattern[0] != NUL) {
if (!fuzzy) {
- match = vim_regexec(regmatch, str, (colnr_T)0);
+ match = vim_regexec(regmatch, str, 0);
} else {
score = fuzzy_match_str(str, pat);
match = (score != 0);
@@ -3141,7 +3141,7 @@ static int ExpandUserDefined(const char *const pat, expand_T *xp, regmatch_T *re
int score = 0;
if (xp->xp_pattern[0] != NUL) {
if (!fuzzy) {
- match = vim_regexec(regmatch, s, (colnr_T)0);
+ match = vim_regexec(regmatch, s, 0);
} else {
score = fuzzy_match_str(s, pat);
match = (score != 0);
diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c
index f1c57c4613..5e196011d7 100644
--- a/src/nvim/cmdhist.c
+++ b/src/nvim/cmdhist.c
@@ -463,7 +463,7 @@ static int del_history_entry(int histype, char *str)
if (hisptr->hisstr == NULL) {
break;
}
- if (vim_regexec(&regmatch, hisptr->hisstr, (colnr_T)0)) {
+ if (vim_regexec(&regmatch, hisptr->hisstr, 0)) {
found = true;
hist_free_entry(hisptr);
} else {
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index 755579a3bc..2d27ae4f0a 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -756,8 +756,8 @@ linenr_T dbg_find_breakpoint(bool file, char *fname, linenr_T after)
/// @returns true if profiling is on for a function or sourced file.
bool has_profiling(bool file, char *fname, bool *fp)
{
- return debuggy_find(file, fname, (linenr_T)0, &prof_ga, fp)
- != (linenr_T)0;
+ return debuggy_find(file, fname, 0, &prof_ga, fp)
+ != 0;
}
/// Common code for dbg_find_breakpoint() and has_profiling().
@@ -776,7 +776,7 @@ static linenr_T debuggy_find(bool file, char *fname, linenr_T after, garray_T *g
// Return quickly when there are no breakpoints.
if (GA_EMPTY(gap)) {
- return (linenr_T)0;
+ return 0;
}
// Replace K_SNR in function name with "<SNR>".
@@ -799,7 +799,7 @@ static linenr_T debuggy_find(bool file, char *fname, linenr_T after, garray_T *g
// while matching should abort it.
prev_got_int = got_int;
got_int = false;
- if (vim_regexec_prog(&bp->dbg_prog, false, name, (colnr_T)0)) {
+ if (vim_regexec_prog(&bp->dbg_prog, false, name, 0)) {
lnum = bp->dbg_lnum;
if (fp != NULL) {
*fp = bp->dbg_forceit;
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 920a535ddf..27c4899e05 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -824,7 +824,7 @@ static int diff_write(buf_T *buf, diffin_T *din)
// so it shouldn't update the '[ and '] marks.
cmdmod.cmod_flags |= CMOD_LOCKMARKS;
int r = buf_write(buf, din->din_fname, NULL,
- (linenr_T)1, buf->b_ml.ml_line_count,
+ 1, buf->b_ml.ml_line_count,
NULL, false, false, false, true);
cmdmod.cmod_flags = save_cmod_flags;
free_string_option(buf->b_p_ff);
@@ -1208,7 +1208,7 @@ void ex_diffpatch(exarg_T *eap)
// Write the current buffer to "tmp_orig".
if (buf_write(curbuf, tmp_orig, NULL,
- (linenr_T)1, curbuf->b_ml.ml_line_count,
+ 1, curbuf->b_ml.ml_line_count,
NULL, false, false, false, true) == FAIL) {
goto theend;
}
@@ -3106,7 +3106,7 @@ static void diffgetput(const int addr_count, const int idx_cur, const int idx_fr
// which results in inaccurate reporting of the byte count of
// previous contents in buffer-update events.
buf_empty = false;
- ml_delete((linenr_T)2, false);
+ ml_delete(2, false);
}
}
linenr_T new_count = dp->df_count[idx_to] + added;
@@ -3360,7 +3360,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp)
if (idx == DB_COUNT) {
// safety check
- return (linenr_T)0;
+ return 0;
}
if (curtab->tp_diff_invalid) {
@@ -3386,7 +3386,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp)
if (i == DB_COUNT) {
// safety check
- return (linenr_T)0;
+ return 0;
}
linenr_T n = lnum + (dp->df_lnum[i] - dp->df_lnum[idx]);
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 390cdbb377..e1216663cd 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2241,7 +2241,7 @@ int pattern_match(const char *pat, const char *text, bool ic)
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
if (regmatch.regprog != NULL) {
regmatch.rm_ic = ic;
- matches = vim_regexec_nl(&regmatch, text, (colnr_T)0);
+ matches = vim_regexec_nl(&regmatch, text, 0);
vim_regfree(regmatch.regprog);
}
p_cpo = save_cpo;
@@ -8794,7 +8794,7 @@ typval_T eval_call_provider(char *provider, char *method, list_T *arguments, boo
return (typval_T){
.v_type = VAR_NUMBER,
.v_lock = VAR_UNLOCKED,
- .vval.v_number = (varnumber_T)0
+ .vval.v_number = 0
};
}
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 4b50710649..aff4f1de62 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -963,7 +963,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
funccall_T *fc = create_funccal(fp, rettv);
fc->fc_level = ex_nesting_level;
// Check if this function has a breakpoint.
- fc->fc_breakpoint = dbg_find_breakpoint(false, fp->uf_name, (linenr_T)0);
+ fc->fc_breakpoint = dbg_find_breakpoint(false, fp->uf_name, 0);
fc->fc_dbg_tick = debug_tick;
// Set up fields for closure.
ga_init(&fc->fc_ufuncs, sizeof(ufunc_T *), 1);
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index bb3284a6b8..7400501ee3 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -670,7 +670,7 @@ void ex_sort(exarg_T *eap)
// Copy the line into a buffer, it may become invalid in
// ml_append(). And it's needed for "unique".
STRCPY(sortbuf1, s);
- if (ml_append(lnum++, sortbuf1, (colnr_T)0, false) == FAIL) {
+ if (ml_append(lnum++, sortbuf1, 0, false) == FAIL) {
break;
}
new_count += (bcount_t)bytelen;
@@ -762,7 +762,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
}
for (extra = 0, l = line1; l <= line2; l++) {
char *str = xstrdup(ml_get(l + extra));
- ml_append(dest + l - line1, str, (colnr_T)0, false);
+ ml_append(dest + l - line1, str, 0, false);
xfree(str);
if (dest < line1) {
extra++;
@@ -900,7 +900,7 @@ void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
// need to use xstrdup() because the line will be unlocked within
// ml_append()
char *p = xstrdup(ml_get(line1));
- ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, false);
+ ml_append(curwin->w_cursor.lnum, p, 0, false);
xfree(p);
// situation 2: skip already copied lines
@@ -1214,7 +1214,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b
if (do_out) {
if (otmp != NULL) {
- if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap,
+ if (readfile(otmp, NULL, line2, 0, (linenr_T)MAXLNUM, eap,
READ_FILTER, false) != OK) {
if (!aborting()) {
msg_putchar('\n');
@@ -1682,7 +1682,7 @@ int do_write(exarg_T *eap)
if (other) {
if (vim_strchr(p_cpo, CPO_ALTWRITE) != NULL
|| eap->cmdidx == CMD_saveas) {
- alt_buf = setaltfname(ffname, fname, (linenr_T)1);
+ alt_buf = setaltfname(ffname, fname, 1);
} else {
alt_buf = buflist_findname(ffname);
}
@@ -2243,7 +2243,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
oldwin = NULL;
}
- if ((command != NULL || newlnum > (linenr_T)0)
+ if ((command != NULL || newlnum > 0)
&& *get_vim_var_str(VV_SWAPCOMMAND) == NUL) {
// Set v:swapcommand for the SwapExists autocommands.
const size_t len = (command != NULL) ? strlen(command) + 3 : 30;
@@ -2858,7 +2858,7 @@ void ex_append(exarg_T *eap)
}
did_undo = true;
- ml_append(lnum, theline, (colnr_T)0, false);
+ ml_append(lnum, theline, 0, false);
if (empty) {
// there are no marks below the inserted lines
appended_lines(lnum, 1);
@@ -3524,7 +3524,7 @@ static int do_sub(exarg_T *eap, const proftime_T timeout, const int cmdpreview_n
|| lnum <= curwin->w_botline);
lnum++) {
int nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
- (colnr_T)0, NULL, NULL);
+ 0, NULL, NULL);
if (nmatch) {
colnr_T copycol;
colnr_T matchcol;
diff --git a/src/nvim/ex_cmds.h b/src/nvim/ex_cmds.h
index 148065e096..f101c1b710 100644
--- a/src/nvim/ex_cmds.h
+++ b/src/nvim/ex_cmds.h
@@ -20,9 +20,9 @@
#define ECMD_NOWINENTER 0x40 // do not trigger BufWinEnter
// for lnum argument in do_ecmd()
-#define ECMD_LASTL (linenr_T)0 // use last position in loaded file
-#define ECMD_LAST ((linenr_T)(-1)) // use last position in all files
-#define ECMD_ONE (linenr_T)1 // use first line
+#define ECMD_LASTL 0 // use last position in loaded file
+#define ECMD_LAST (-1) // use last position in all files
+#define ECMD_ONE 1 // use first line
/// Previous :substitute replacement string definition
typedef struct {
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 199a5bdd43..e4c04007e0 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -436,7 +436,7 @@ int buf_write_all(buf_T *buf, int forceit)
buf_T *old_curbuf = curbuf;
retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
- (linenr_T)1, buf->b_ml.ml_line_count, NULL,
+ 1, buf->b_ml.ml_line_count, NULL,
false, forceit, true, false));
if (curbuf != old_curbuf) {
msg_source(HL_ATTR(HLF_W));
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ad09ee6bb1..e8233d512a 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3124,7 +3124,7 @@ int cmd_exists(const char *const name)
// For ":2match" and ":3match" we need to skip the number.
exarg_T ea;
ea.cmd = (char *)((*name == '2' || *name == '3') ? name + 1 : name);
- ea.cmdidx = (cmdidx_T)0;
+ ea.cmdidx = 0;
ea.flags = 0;
int full = false;
char *p = find_ex_command(&ea, &full);
@@ -3155,7 +3155,7 @@ void f_fullcommand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
exarg_T ea;
ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name;
- ea.cmdidx = (cmdidx_T)0;
+ ea.cmdidx = 0;
ea.flags = 0;
char *p = find_ex_command(&ea, NULL);
if (p == NULL || ea.cmdidx == CMD_SIZE) {
@@ -3177,7 +3177,7 @@ cmdidx_T excmd_get_cmdidx(const char *cmd, size_t len)
cmdidx_T idx;
if (!one_letter_cmd(cmd, &idx)) {
- for (idx = (cmdidx_T)0; (int)idx < CMD_SIZE; idx = (cmdidx_T)((int)idx + 1)) {
+ for (idx = 0; (int)idx < CMD_SIZE; idx = (cmdidx_T)((int)idx + 1)) {
if (strncmp(cmdnames[(int)idx].cmd_name, cmd, len) == 0) {
break;
}
@@ -5554,13 +5554,13 @@ static void ex_read(exarg_T *eap)
return;
}
i = readfile(curbuf->b_ffname, curbuf->b_fname,
- eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false);
+ eap->line2, 0, (linenr_T)MAXLNUM, eap, 0, false);
} else {
if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) {
- (void)setaltfname(eap->arg, eap->arg, (linenr_T)1);
+ (void)setaltfname(eap->arg, eap->arg, 1);
}
i = readfile(eap->arg, NULL,
- eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false);
+ eap->line2, 0, (linenr_T)MAXLNUM, eap, 0, false);
}
if (i != OK) {
if (!aborting()) {
@@ -6632,7 +6632,7 @@ static void ex_checkpath(exarg_T *eap)
{
find_pattern_in_path(NULL, 0, 0, false, false, CHECK_PATH, 1,
eap->forceit ? ACTION_SHOW_ALL : ACTION_SHOW,
- (linenr_T)1, (linenr_T)MAXLNUM);
+ 1, (linenr_T)MAXLNUM);
}
/// ":psearch"
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index a47c9027a7..b7c07ce02c 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -1396,7 +1396,7 @@ void ex_catch(exarg_T *eap)
int prev_got_int = got_int;
got_int = false;
- caught = vim_regexec_nl(&regmatch, current_exception->value, (colnr_T)0);
+ caught = vim_regexec_nl(&regmatch, current_exception->value, 0);
got_int |= prev_got_int;
vim_regfree(regmatch.regprog);
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index dbf14f20ad..ce47471976 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4371,7 +4371,7 @@ static int open_cmdwin(void)
i = 0;
}
if (get_histentry(histtype)[i].hisstr != NULL) {
- ml_append(lnum++, get_histentry(histtype)[i].hisstr, (colnr_T)0, false);
+ ml_append(lnum++, get_histentry(histtype)[i].hisstr, 0, false);
}
} while (i != *get_hisidx(histtype));
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 424bd33b6c..e57fb9664b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -3132,7 +3132,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
savebuf = NULL;
} else {
// Allocate a buffer without putting it in the buffer list.
- savebuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
+ savebuf = buflist_new(NULL, NULL, 1, BLN_DUMMY);
set_bufref(&bufref, savebuf);
if (savebuf != NULL && buf == curbuf) {
// Open the memline.
@@ -3153,7 +3153,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
if (saved == OK) {
curbuf->b_flags |= BF_CHECK_RO; // check for RO again
keep_filetype = true; // don't detect 'filetype'
- if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0,
+ if (readfile(buf->b_ffname, buf->b_fname, 0, 0,
(linenr_T)MAXLNUM, &ea, flags, false) != OK) {
if (!aborting()) {
semsg(_("E321: Could not reload \"%s\""), buf->b_fname);
@@ -3583,10 +3583,10 @@ bool match_file_pat(char *pattern, regprog_T **prog, char *fname, char *sfname,
// 3. the tail of the file name, when the pattern has no '/'.
if (regmatch.regprog != NULL
&& ((allow_dirs
- && (vim_regexec(&regmatch, fname, (colnr_T)0)
+ && (vim_regexec(&regmatch, fname, 0)
|| (sfname != NULL
- && vim_regexec(&regmatch, sfname, (colnr_T)0))))
- || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0)))) {
+ && vim_regexec(&regmatch, sfname, 0))))
+ || (!allow_dirs && vim_regexec(&regmatch, tail, 0)))) {
result = true;
}
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index fa33abdce7..b5b55b1b16 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -110,8 +110,8 @@ static const char *e_nofold = N_("E490: No fold found");
// While updating the folds lines between invalid_top and invalid_bot have an
// undefined fold level. Only used for the window currently being updated.
-static linenr_T invalid_top = (linenr_T)0;
-static linenr_T invalid_bot = (linenr_T)0;
+static linenr_T invalid_top = 0;
+static linenr_T invalid_bot = 0;
// When using 'foldexpr' we sometimes get the level of the next line, which
// calls foldlevel() to get the level of the current line, which hasn't been
@@ -268,7 +268,7 @@ static int foldLevel(linenr_T lnum)
{
// While updating the folds lines between invalid_top and invalid_bot have
// an undefined fold level. Otherwise update the folds first.
- if (invalid_top == (linenr_T)0) {
+ if (invalid_top == 0) {
checkupdate(curwin);
} else if (lnum == prev_lnum && prev_lnum_lvl >= 0) {
return prev_lnum_lvl;
@@ -748,7 +748,7 @@ void deleteFold(win_T *const wp, const linenr_T start, const linenr_T end, const
}
if (last_lnum > 0) {
- changed_lines(wp->w_buffer, first_lnum, (colnr_T)0, last_lnum, 0, false);
+ changed_lines(wp->w_buffer, first_lnum, 0, last_lnum, 0, false);
// send one nvim_buf_lines_event at the end
// last_lnum is the line *after* the last line of the outermost fold
@@ -1129,7 +1129,7 @@ static void checkupdate(win_T *wp)
return;
}
- foldUpdate(wp, (linenr_T)1, (linenr_T)MAXLNUM); // will update all
+ foldUpdate(wp, 1, (linenr_T)MAXLNUM); // will update all
wp->w_foldinvalid = false;
}
@@ -1364,7 +1364,7 @@ void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, linenr_T amount,
}
// If appending a line in Insert mode, it should be included in the fold
// just above the line.
- if ((State & MODE_INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) {
+ if ((State & MODE_INSERT) && amount == 1 &a