1
0
forked from aniani/vim

patch 9.1.1122: too many strlen() calls in findfile.c

Problem:  too many strlen() calls in findfile.c
Solution: refactor findfile.c and remove calls to strlen()
          (John Marriott)

closes: #16595

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
John Marriott
2025-02-18 20:45:48 +01:00
committed by Christian Brabandt
parent 07f0dbe3aa
commit d6e3c9048d
4 changed files with 514 additions and 294 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/* findfile.c */ /* findfile.c */
void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname); void *vim_findfile_init(char_u *path, char_u *filename, size_t filenamelen, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname);
char_u *vim_findfile_stopdir(char_u *buf); char_u *vim_findfile_stopdir(char_u *buf);
void vim_findfile_cleanup(void *ctx); void vim_findfile_cleanup(void *ctx);
char_u *vim_findfile(void *search_ctx_arg); char_u *vim_findfile(void *search_ctx_arg);
@@ -14,6 +14,6 @@ char_u *find_file_name_in_path(char_u *ptr, int len, int options, long count, ch
int vim_ispathlistsep(int c); int vim_ispathlistsep(int c);
void uniquefy_paths(garray_T *gap, char_u *pattern, char_u *path_option); void uniquefy_paths(garray_T *gap, char_u *pattern, char_u *path_option);
int expand_in_path(garray_T *gap, char_u *pattern, int flags); int expand_in_path(garray_T *gap, char_u *pattern, int flags);
void simplify_filename(char_u *filename); size_t simplify_filename(char_u *filename);
void f_simplify(typval_T *argvars, typval_T *rettv); void f_simplify(typval_T *argvars, typval_T *rettv);
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -3421,6 +3421,7 @@ get_tagfname(
*filename++ = NUL; *filename++ = NUL;
tnp->tn_search_ctx = vim_findfile_init(buf, filename, tnp->tn_search_ctx = vim_findfile_init(buf, filename,
STRLEN(filename),
r_ptr, 100, r_ptr, 100,
FALSE, // don't free visited list FALSE, // don't free visited list
FINDFILE_FILE, // we search for a file FINDFILE_FILE, // we search for a file

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1122,
/**/ /**/
1121, 1121,
/**/ /**/