mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1400: find_file_in_path() is not reentrant
Problem: find_file_in_path() is not reentrant. Solution: Instead of global variables pass pointers to the functions. (closes #12093)
This commit is contained in:
@@ -982,6 +982,9 @@ findfilendir(
|
||||
|
||||
if (*fname != NUL && !error)
|
||||
{
|
||||
char_u *file_to_find = NULL;
|
||||
char *search_ctx = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST)
|
||||
@@ -992,13 +995,17 @@ findfilendir(
|
||||
find_what,
|
||||
curbuf->b_ffname,
|
||||
find_what == FINDFILE_DIR
|
||||
? (char_u *)"" : curbuf->b_p_sua);
|
||||
? (char_u *)"" : curbuf->b_p_sua,
|
||||
&file_to_find, &search_ctx);
|
||||
first = FALSE;
|
||||
|
||||
if (fresult != NULL && rettv->v_type == VAR_LIST)
|
||||
list_append_string(rettv->vval.v_list, fresult, -1);
|
||||
|
||||
} while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL);
|
||||
|
||||
vim_free(file_to_find);
|
||||
vim_findfile_cleanup(search_ctx);
|
||||
}
|
||||
|
||||
if (rettv->v_type == VAR_STRING)
|
||||
|
Reference in New Issue
Block a user