mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
file_search: Change return type of ff_wc_equal to bool.
This makes sense since the function returns only TRUE or FALSE.
This commit is contained in:
@@ -1046,27 +1046,27 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
|
|||||||
return retptr;
|
return retptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Check if two wildcard paths are equal.
|
||||||
* check if two wildcard paths are equal. Returns TRUE or FALSE.
|
// They are equal if:
|
||||||
* They are equal if:
|
// - both paths are NULL
|
||||||
* - both paths are NULL
|
// - they have the same length
|
||||||
* - they have the same length
|
// - char by char comparison is OK
|
||||||
* - char by char comparison is OK
|
// - the only differences are in the counters behind a '**', so
|
||||||
* - the only differences are in the counters behind a '**', so
|
// '**\20' is equal to '**\24'
|
||||||
* '**\20' is equal to '**\24'
|
static bool ff_wc_equal(char_u *s1, char_u *s2)
|
||||||
*/
|
|
||||||
static int ff_wc_equal(char_u *s1, char_u *s2)
|
|
||||||
{
|
{
|
||||||
int c1 = NUL;
|
int c1 = NUL;
|
||||||
int c2 = NUL;
|
int c2 = NUL;
|
||||||
int prev1 = NUL;
|
int prev1 = NUL;
|
||||||
int prev2 = NUL;
|
int prev2 = NUL;
|
||||||
|
|
||||||
if (s1 == s2)
|
if (s1 == s2) {
|
||||||
return TRUE;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (s1 == NULL || s2 == NULL)
|
if (s1 == NULL || s2 == NULL) {
|
||||||
return FALSE;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
|
for (int i = 0, j = 0; s1[i] != NUL && s2[j] != NUL;) {
|
||||||
c1 = PTR2CHAR(s1 + i);
|
c1 = PTR2CHAR(s1 + i);
|
||||||
@@ -1113,12 +1113,13 @@ static int ff_check_visited(ff_visited_T **visited_list, char_u *fname, char_u *
|
|||||||
if ((url && fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0)
|
if ((url && fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0)
|
||||||
|| (!url && vp->file_id_valid
|
|| (!url && vp->file_id_valid
|
||||||
&& os_fileid_equal(&(vp->file_id), &file_id))) {
|
&& os_fileid_equal(&(vp->file_id), &file_id))) {
|
||||||
/* are the wildcard parts equal */
|
// are the wildcard parts equal
|
||||||
if (ff_wc_equal(vp->ffv_wc_path, wc_path) == TRUE)
|
if (ff_wc_equal(vp->ffv_wc_path, wc_path)) {
|
||||||
/* already visited */
|
// already visited
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* New file/dir. Add it to the list of visited files/dirs.
|
* New file/dir. Add it to the list of visited files/dirs.
|
||||||
|
Reference in New Issue
Block a user