diff options
-rw-r--r-- | src/nvim/search.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index b252612e5d..84782497a0 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -1493,38 +1493,34 @@ static int check_prevcol(char_u *linep, int col, int ch, int *prevcol) * Raw string start is found at linep[startpos.col - 1]. * Return true if the matching end can be found between startpos and endpos. */ -static int find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos) +static bool find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos) { char_u *p; char_u *delim_copy; size_t delim_len; linenr_T lnum; - int found = false; - for (p = linep + startpos->col + 1; *p && *p != '('; ++p) {} + for (p = linep + startpos->col + 1; *p && *p != '('; p++) {} delim_len = (p - linep) - startpos->col - 1; delim_copy = vim_strnsave(linep + startpos->col + 1, delim_len); - if (delim_copy == NULL) - return false; - for (lnum = startpos->lnum; lnum <= endpos->lnum; ++lnum) - { + bool found = false; + for (lnum = startpos->lnum; lnum <= endpos->lnum; lnum++) { char_u *line = ml_get(lnum); - for (p = line + (lnum == startpos->lnum - ? startpos->col + 1 : 0); *p; ++p) - { - if (lnum == endpos->lnum && (colnr_T)(p - line) >= endpos->col) + for (p = line + (lnum == startpos->lnum ? startpos->col + 1 : 0); *p; p++) { + if (lnum == endpos->lnum && (colnr_T)(p - line) >= endpos->col) { break; + } if (*p == ')' && p[delim_len + 1] == '"' - && STRNCMP(delim_copy, p + 1, delim_len) == 0) - { + && STRNCMP(delim_copy, p + 1, delim_len) == 0) { found = true; break; } } - if (found) + if (found) { break; + } } xfree(delim_copy); return found; |