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.
This commit is contained in:
Jan Edmund Lazo 2018-08-23 19:07:19 -04:00
parent 42428b3f85
commit 748cd91c20

View File

@ -2216,15 +2216,12 @@ showmatch(
// sentence when found. If the next sentence is found, return OK. Return FAIL // sentence when found. If the next sentence is found, return OK. Return FAIL
// otherwise. See ":h sentence" for the precise definition of a "sentence" // otherwise. See ":h sentence" for the precise definition of a "sentence"
// text object. // text object.
int findsent(int dir, long count) int findsent(Direction dir, long count)
{ {
pos_T pos, tpos; pos_T pos, tpos;
int c; int c;
int (*func)(pos_T *); int (*func)(pos_T *);
int startlnum; bool noskip = false; // do not skip blanks
int noskip = FALSE; /* do not skip blanks */
int cpo_J;
int found_dot;
pos = curwin->w_cursor; pos = curwin->w_cursor;
if (dir == FORWARD) if (dir == FORWARD)
@ -2259,7 +2256,7 @@ int findsent(int dir, long count)
} }
// go back to the previous non-white non-punctuation character // 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) while (c = gchar_pos(&pos), ascii_iswhite(c)
|| vim_strchr((char_u *)".!?)]\"'", c) != NULL) { || vim_strchr((char_u *)".!?)]\"'", c) != NULL) {
tpos = pos; tpos = pos;
@ -2279,9 +2276,9 @@ int findsent(int dir, long count)
decl(&pos); decl(&pos);
} }
/* remember the line where the search started */ // remember the line where the search started
startlnum = pos.lnum; const int startlnum = pos.lnum;
cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL; const bool cpo_J = vim_strchr(p_cpo, CPO_ENDOFSENT) != NULL;
for (;; ) { /* find end of sentence */ for (;; ) { /* find end of sentence */
c = gchar_pos(&pos); c = gchar_pos(&pos);
@ -2309,7 +2306,7 @@ int findsent(int dir, long count)
if ((*func)(&pos) == -1) { if ((*func)(&pos) == -1) {
if (count) if (count)
return FAIL; return FAIL;
noskip = TRUE; noskip = true;
break; break;
} }
} }