This PR refactors concat_fnames() to remove calls to STRLEN().
Function concat_fnames() can make up to 5 calls to STRLEN() (either directly or indirectly via STRCAT()). In many cases the lengths of arguments fname1 and/or fname2 are either known or can be calculated simply.
This PR refactors this function to accept the lengths of arguments fname1 and fname2 as arguments. It also adds new argument ret to return the resulting string as a string_T.
In addition:
In scriptfile.c:
->In function add_pack_dir_to_rtp():
->->Use a string_T to store local variables new_rtp and afterdir.
->->Replace calls to STRCAT() with calls to STRCPY().
->->Change type of variable keep to size_t for consistency with other lengths.
In quickfix.c:
->In function qf_get_fnum(), use a string_T to store local variables ptr and bufname.
->In function qf_push_dir():
->->Use a string_T to store local variable dirname.
->->Replace call to vim_strsave() with vim_strnsave().
->In function qf_guess_filepath():
->->Use a string_T to store local variable fullname.
In memline.c:
->In function make_percent_swname():
->->Rename some variables to better reflect their use.
->->Use a string_T to store local variables d and fixed_name.
->->Slightly refactor to remove need to create an extra string.
->In function get_file_in_dir():
->->Use a string_T to store local variables tail and retval.
->->Move some variables closer to where they are used.
In if_cscope.c:
->In function cs_resolve_file():
->->Use a string_T to store local variable csdir.
->->Remove one call to STRLEN().
In filepath.c:
->Function add_pathsep() can make up to 2 calls to STRLEN() (either directory or indirectly via STRCAT()). Slightly refactor to remove one call (replacing call to STRCAT() with a call to STRCPY()).
In option.c:
->In function set_init_xdg_rtp(), use a string_T to store local variable vimrc_xdg.
Cheers
John
https://github.com/vim/vim/pull/19854
(11 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@basilisk0315 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@basilisk0315 pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()