diff options
author | dundargoc <gocdundar@gmail.com> | 2023-11-11 11:20:08 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-11-11 13:31:17 +0100 |
commit | 8e58d37f2e15ac8540377148e55ed08a039aadb6 (patch) | |
tree | 799dd1f30d375ac8cdeae196fceec9d2ad0f134a /src/nvim/fold.c | |
parent | c4ad15ae324f6460c683a64c44d65e693e1f39bb (diff) | |
download | rneovim-8e58d37f2e15ac8540377148e55ed08a039aadb6.tar.gz rneovim-8e58d37f2e15ac8540377148e55ed08a039aadb6.tar.bz2 rneovim-8e58d37f2e15ac8540377148e55ed08a039aadb6.zip |
refactor: remove redundant casts
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r-- | src/nvim/fold.c | 32 |
1 files changed, 16 insertions, 16 deletions
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 && line2 == MAXLNUM) { line1--; } foldMarkAdjustRecurse(wp, &wp->w_folds, line1, line2, amount, amount_after); @@ -1382,7 +1382,7 @@ static void foldMarkAdjustRecurse(win_T *wp, garray_T *gap, linenr_T line1, line // In Insert mode an inserted line at the top of a fold is considered part // of the fold, otherwise it isn't. - if ((State & MODE_INSERT) && amount == (linenr_T)1 && line2 == MAXLNUM) { + if ((State & MODE_INSERT) && amount == 1 && line2 == MAXLNUM) { top = line1 + 1; } else { top = line1; @@ -1584,7 +1584,7 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end) // Update both changes here, to avoid all folds after the start are // changed when the start marker is inserted and the end isn't. - changed_lines(buf, start.lnum, (colnr_T)0, end.lnum, 0, false); + changed_lines(buf, start.lnum, 0, end.lnum, 0, false); // Note: foldAddMarker() may not actually change start and/or end if // u_save() is unable to save the buffer line, but we send the @@ -1911,7 +1911,7 @@ static void foldtext_cleanup(char *str) static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot) { // Avoid problems when being called recursively. - if (invalid_top != (linenr_T)0) { + if (invalid_top != 0) { return; } @@ -2132,7 +2132,7 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot) } } - invalid_top = (linenr_T)0; + invalid_top = 0; } // foldUpdateIEMSRecurse() {{{2 @@ -2294,12 +2294,12 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level, // We will move the start of this fold up, hence we move all // nested folds (with relative line numbers) down. foldMarkAdjustRecurse(flp->wp, &fp->fd_nested, - (linenr_T)0, (linenr_T)MAXLNUM, + 0, (linenr_T)MAXLNUM, (fp->fd_top - firstlnum), 0); } else { // Will move fold down, move nested folds relatively up. foldMarkAdjustRecurse(flp->wp, &fp->fd_nested, - (linenr_T)0, + 0, (firstlnum - fp->fd_top - 1), (linenr_T)MAXLNUM, (fp->fd_top - firstlnum)); @@ -2537,7 +2537,7 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level, if (fp2->fd_top < flp->lnum) { // Make fold that includes lnum start at lnum. foldMarkAdjustRecurse(flp->wp, &fp2->fd_nested, - (linenr_T)0, (flp->lnum - fp2->fd_top - 1), + 0, (flp->lnum - fp2->fd_top - 1), (linenr_T)MAXLNUM, (fp2->fd_top - flp->lnum)); fp2->fd_len -= flp->lnum - fp2->fd_top; fp2->fd_top = flp->lnum; @@ -2675,7 +2675,7 @@ static void foldRemove(win_T *const wp, garray_T *gap, linenr_T top, linenr_T bo if (fp->fd_top + fp->fd_len - 1 > bot) { // 5: Make fold that includes bot start below bot. foldMarkAdjustRecurse(wp, &fp->fd_nested, - (linenr_T)0, (bot - fp->fd_top), + 0, (bot - fp->fd_top), (linenr_T)MAXLNUM, (fp->fd_top - bot - 1)); fp->fd_len -= bot - fp->fd_top + 1; fp->fd_top = bot + 1; @@ -3132,7 +3132,7 @@ int put_folds(FILE *fd, win_T *wp) { if (foldmethodIsManual(wp)) { if (put_line(fd, "silent! normal! zE") == FAIL - || put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL + || put_folds_recurse(fd, &wp->w_folds, 0) == FAIL || put_line(fd, "let &fdl = &fdl") == FAIL) { return FAIL; } @@ -3140,7 +3140,7 @@ int put_folds(FILE *fd, win_T *wp) // If some folds are manually opened/closed, need to restore that. if (wp->w_fold_manual) { - return put_foldopen_recurse(fd, wp, &wp->w_folds, (linenr_T)0); + return put_foldopen_recurse(fd, wp, &wp->w_folds, 0); } return OK; |