aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-02 12:50:48 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-02 12:50:50 -0400
commita515401cf01b8bb03c67b9c06a1f98c4580ba7f7 (patch)
tree15d1b5101c5e052741af82a186843f76bbb32209
parent407ac8b42d74963a08c61ffb146ed41a941dc43d (diff)
downloadrneovim-a515401cf01b8bb03c67b9c06a1f98c4580ba7f7.tar.gz
rneovim-a515401cf01b8bb03c67b9c06a1f98c4580ba7f7.tar.bz2
rneovim-a515401cf01b8bb03c67b9c06a1f98c4580ba7f7.zip
fold: add const to foldMoveTo() variables
Declare and initialize variables on same line if possible.
-rw-r--r--src/nvim/fold.c51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 4db237a7b9..129823f803 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -822,42 +822,34 @@ void foldUpdateAll(win_T *win)
redraw_win_later(win, NOT_VALID);
}
-/* foldMoveTo() {{{2 */
-/*
- * If "updown" is FALSE: Move to the start or end of the fold.
- * If "updown" is TRUE: move to fold at the same level.
- * If not moved return FAIL.
- */
-int
-foldMoveTo(
- int updown,
- int dir, // FORWARD or BACKWARD
- long count
+// foldMoveTo() {{{2
+//
+// If "updown" is false: Move to the start or end of the fold.
+// If "updown" is true: move to fold at the same level.
+// If not moved return FAIL.
+int foldMoveTo(
+ const bool updown,
+ const int dir, // FORWARD or BACKWARD
+ const long count
)
{
- long n;
int retval = FAIL;
- linenr_T lnum_off;
- linenr_T lnum_found;
linenr_T lnum;
- garray_T *gap;
fold_T *fp;
- int level;
- int last;
checkupdate(curwin);
- /* Repeat "count" times. */
- for (n = 0; n < count; ++n) {
- /* Find nested folds. Stop when a fold is closed. The deepest fold
- * that moves the cursor is used. */
- lnum_off = 0;
- gap = &curwin->w_folds;
+ // Repeat "count" times.
+ for (long n = 0; n < count; n++) {
+ // Find nested folds. Stop when a fold is closed. The deepest fold
+ // that moves the cursor is used.
+ linenr_T lnum_off = 0;
+ garray_T *gap = &curwin->w_folds;
bool use_level = false;
bool maybe_small = false;
- lnum_found = curwin->w_cursor.lnum;
- level = 0;
- last = FALSE;
+ linenr_T lnum_found = curwin->w_cursor.lnum;
+ int level = 0;
+ bool last = false;
for (;; ) {
if (!foldFind(gap, curwin->w_cursor.lnum - lnum_off, &fp)) {
if (!updown)
@@ -875,14 +867,15 @@ foldMoveTo(
}
/* don't look for contained folds, they will always move
* the cursor too far. */
- last = TRUE;
+ last = true;
}
if (!last) {
/* Check if this fold is closed. */
if (check_closed(curwin, fp, &use_level, level,
- &maybe_small, lnum_off))
- last = TRUE;
+ &maybe_small, lnum_off)) {
+ last = true;
+ }
/* "[z" and "]z" stop at closed fold */
if (last && !updown)