aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-12-28 13:42:24 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-12-30 12:45:38 +0100
commitc89292fcb7f2ebf06efb7c1d00c28f34c6f68fec (patch)
treeb1257a572495337ca936c47839bb08aa45528c84 /src/nvim/fold.c
parentd634cd5b0bc3ac6bdf285432f74a1c10f12b6031 (diff)
downloadrneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.gz
rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.bz2
rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.zip
refactor: follow style guide
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 3b7662e62d..863c61d958 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -371,7 +371,7 @@ void closeFold(pos_T pos, int count)
/// Close fold for current window at position `pos` recursively.
void closeFoldRecurse(pos_T pos)
{
- (void)setManualFold(pos, false, true, NULL);
+ setManualFold(pos, false, true, NULL);
}
// opFoldRange() {{{2
@@ -382,7 +382,7 @@ void closeFoldRecurse(pos_T pos)
/// @param opening true to open, false to close
/// @param recurse true to do it recursively
/// @param had_visual true when Visual selection used
-void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, int had_visual)
+void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, bool had_visual)
{
int done = DONE_NOTHING; // avoid error messages
linenr_T first = firstpos.lnum;
@@ -395,13 +395,13 @@ void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, int ha
// Opening one level only: next fold to open is after the one going to
// be opened.
if (opening && !recurse) {
- (void)hasFolding(lnum, NULL, &lnum_next);
+ hasFolding(lnum, NULL, &lnum_next);
}
- (void)setManualFold(temp, opening, recurse, &done);
+ setManualFold(temp, opening, recurse, &done);
// Closing one level only: next line to close a fold is after just
// closed fold.
if (!opening && !recurse) {
- (void)hasFolding(lnum, NULL, &lnum_next);
+ hasFolding(lnum, NULL, &lnum_next);
}
}
if (done == DONE_NOTHING) {
@@ -425,7 +425,7 @@ void openFold(pos_T pos, int count)
/// Open fold for current window at position `pos` recursively.
void openFoldRecurse(pos_T pos)
{
- (void)setManualFold(pos, true, true, NULL);
+ setManualFold(pos, true, true, NULL);
}
// foldOpenCursor() {{{2
@@ -436,7 +436,7 @@ void foldOpenCursor(void)
if (hasAnyFolding(curwin)) {
while (true) {
int done = DONE_NOTHING;
- (void)setManualFold(curwin->w_cursor, true, false, &done);
+ setManualFold(curwin->w_cursor, true, false, &done);
if (!(done & DONE_ACTION)) {
break;
}
@@ -793,7 +793,7 @@ void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
maybe_small_end = top;
}
fold_T *fp;
- (void)foldFind(&wp->w_folds, maybe_small_start, &fp);
+ foldFind(&wp->w_folds, maybe_small_start, &fp);
while (fp < (fold_T *)wp->w_folds.ga_data + wp->w_folds.ga_len
&& fp->fd_top <= maybe_small_end) {
fp->fd_small = kNone;
@@ -1027,7 +1027,7 @@ void foldAdjustVisual(void)
/// Move the cursor to the first line of a closed fold.
void foldAdjustCursor(void)
{
- (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL);
+ hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL);
}
// Internal functions for "fold_T" {{{1
@@ -1137,7 +1137,7 @@ static void setFoldRepeat(pos_T pos, int count, int do_open)
{
for (int n = 0; n < count; n++) {
int done = DONE_NOTHING;
- (void)setManualFold(pos, do_open, false, &done);
+ setManualFold(pos, do_open, false, &done);
if (!(done & DONE_ACTION)) {
// Only give an error message when no fold could be opened.
if (n == 0 && !(done & DONE_FOLD)) {
@@ -1154,7 +1154,7 @@ static void setFoldRepeat(pos_T pos, int count, int do_open)
///
/// @param opening true when opening, false when closing
/// @param recurse true when closing/opening recursive
-static linenr_T setManualFold(pos_T pos, int opening, int recurse, int *donep)
+static linenr_T setManualFold(pos_T pos, bool opening, bool recurse, int *donep)
{
if (foldmethodIsDiff(curwin) && curwin->w_p_scb) {
linenr_T dlnum;
@@ -1165,7 +1165,7 @@ static linenr_T setManualFold(pos_T pos, int opening, int recurse, int *donep)
if (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb) {
dlnum = diff_lnum_win(curwin->w_cursor.lnum, wp);
if (dlnum != 0) {
- (void)setManualFoldWin(wp, dlnum, opening, recurse, NULL);
+ setManualFoldWin(wp, dlnum, opening, recurse, NULL);
}
}
}
@@ -1186,7 +1186,7 @@ static linenr_T setManualFold(pos_T pos, int opening, int recurse, int *donep)
///
/// @return the line number of the next line that could be closed.
/// It's only valid when "opening" is true!
-static linenr_T setManualFoldWin(win_T *wp, linenr_T lnum, int opening, int recurse, int *donep)
+static linenr_T setManualFoldWin(win_T *wp, linenr_T lnum, bool opening, bool recurse, int *donep)
{
fold_T *fp;
fold_T *fp2;
@@ -1387,7 +1387,7 @@ static void foldMarkAdjustRecurse(win_T *wp, garray_T *gap, linenr_T line1, line
// Find the fold containing or just below "line1".
fold_T *fp;
- (void)foldFind(gap, line1, &fp);
+ foldFind(gap, line1, &fp);
// Adjust all folds below "line1" that are affected.
for (int i = (int)(fp - (fold_T *)gap->ga_data); i < gap->ga_len; i++, fp++) {
@@ -1634,7 +1634,7 @@ static void foldAddMarker(buf_T *buf, pos_T pos, const char *marker, size_t mark
/// Delete the markers for a fold, causing it to be deleted.
///
/// @param lnum_off offset for fp->fd_top
-static void deleteFoldMarkers(win_T *wp, fold_T *fp, int recursive, linenr_T lnum_off)
+static void deleteFoldMarkers(win_T *wp, fold_T *fp, bool recursive, linenr_T lnum_off)
{
if (recursive) {
for (int i = 0; i < fp->fd_nested.ga_len; i++) {
@@ -2169,7 +2169,7 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
// startlnum, it must be deleted.
if (getlevel == foldlevelMarker && flp->start <= flp->lvl - level
&& flp->lvl > 0) {
- (void)foldFind(gap, startlnum - 1, &fp);
+ foldFind(gap, startlnum - 1, &fp);
if (fp != NULL
&& (fp >= ((fold_T *)gap->ga_data) + gap->ga_len
|| fp->fd_top >= startlnum)) {
@@ -2235,7 +2235,7 @@ static linenr_T foldUpdateIEMSRecurse(garray_T *const gap, const int level,
}
}
if (lvl < level + i) {
- (void)foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2);
+ foldFind(&fp->fd_nested, flp->lnum - fp->fd_top, &fp2);
if (fp2 != NULL) {
bot = fp2->fd_top + fp2->fd_len - 1 + fp->fd_top;
}
@@ -2601,7 +2601,7 @@ static void foldSplit(buf_T *buf, garray_T *const gap, const int i, const linenr
// any between top and bot, they have been removed by the caller.
garray_T *const gap1 = &fp->fd_nested;
garray_T *const gap2 = &fp[1].fd_nested;
- (void)foldFind(gap1, bot + 1 - fp->fd_top, &fp2);
+ foldFind(gap1, bot + 1 - fp->fd_top, &fp2);
if (fp2 != NULL) {
const int len = (int)((fold_T *)gap1->ga_data + gap1->ga_len - fp2);
if (len > 0) {
@@ -3232,7 +3232,7 @@ static int put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off)
// }}}1
/// "foldclosed()" and "foldclosedend()" functions
-static void foldclosed_both(typval_T *argvars, typval_T *rettv, int end)
+static void foldclosed_both(typval_T *argvars, typval_T *rettv, bool end)
{
const linenr_T lnum = tv_get_lnum(argvars);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) {