diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-23 19:07:19 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-23 19:07:19 -0400 |
commit | 748cd91c20bdffe34ac5c9997ac8342cdf9438e1 (patch) | |
tree | 8b12674904464a88a271e090063a8dcf45c488dc | |
parent | 42428b3f857b6390084540e82c0e89a49fc4452f (diff) | |
download | rneovim-748cd91c20bdffe34ac5c9997ac8342cdf9438e1.tar.gz rneovim-748cd91c20bdffe34ac5c9997ac8342cdf9438e1.tar.bz2 rneovim-748cd91c20bdffe34ac5c9997ac8342cdf9438e1.zip |
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.
-rw-r--r-- | src/nvim/search.c | 17 |
1 files changed, 7 insertions, 10 deletions
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; } } |