mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 20:08:17 +00:00
search: Fix PVS/V547: allocator never returns NULL now
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user