From 748cd91c20bdffe34ac5c9997ac8342cdf9438e1 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 23 Aug 2018 19:07:19 -0400 Subject: search: fix types of findsent() variables dir (param) is of type Direction (enum). cpo_J, found_dot, noskip (local var) are bool. cpo_J is const. startlnum (local var) is const int. Declare it in same scope as cpo_J. --- src/nvim/search.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/nvim/search.c b/src/nvim/search.c index fab0ea4837..40d3f74103 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -2216,15 +2216,12 @@ showmatch( // sentence when found. If the next sentence is found, return OK. Return FAIL // otherwise. See ":h sentence" for the precise definition of a "sentence" // text object. -int findsent(int dir, long count) +int findsent(Direction dir, long count) { pos_T pos, tpos; int c; int (*func)(pos_T *); - int startlnum; - int noskip = FALSE; /* do not skip blanks */ - int cpo_J; - int found_dot; + bool noskip = false; // do not skip blanks pos = curwin->w_cursor; if (dir == FORWARD) @@ -2259,7 +2256,7 @@ int findsent(int dir, long count) } // go back to the previous non-white non-punctuation character - found_dot = false; + bool found_dot = false; while (c = gchar_pos(&pos), ascii_iswhite(c) || vim_strchr((char_u *)".!?)]\"'", c) != NULL) { tpos = pos; @@ -2279,9 +2276,9 @@ int findsent(int dir, long count) decl(&pos); } - /* remember the line where the search started */ - startlnum = pos.lnum; - cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL; + // remember the line where the search started + const int startlnum = pos.lnum; + const bool cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL; for (;; ) { /* find end of sentence */ c = gchar_pos(&pos); @@ -2309,7 +2306,7 @@ int findsent(int dir, long count) if ((*func)(&pos) == -1) { if (count) return FAIL; - noskip = TRUE; + noskip = true; break; } } -- cgit