mirror of
https://github.com/neovim/neovim.git
synced 2026-05-02 03:55:00 +00:00
vim-patch:partial:9.1.1887: string handling in strings.c can be improved
Problem: string handling in strings.c can be improved
Solution: Refactor strings.c and remove calls to STRLEN()
(John Marriott)
This change does:
- In vim_strsave_shellescape() a small cosmetic change.
- In string_count() move the call to STRLEN() outside the while loop.
- In blob_from_string() refactor to remove call to STRLEN().
- In string_from_blob() call vim_strnsave() instead of vim_strsave().
- In vim_snprintf_safelen() call vim_vsnprintf_typval() directly instead
of vim_vsnprintf() which then calls vim_vsnprintf_typval().
- In copy_first_char_to_tv() change to return -1 on failure or the length
of resulting v_string. Change string_filter_map() and string_reduce() to
use the return value of copy_first_char_to_tv().
closes: vim/vim#18617
110656ba60
Co-authored-by: John Marriott <basilisk@internode.on.net>
This commit is contained in:
@@ -804,7 +804,7 @@ size_t vim_snprintf_safelen(char *str, size_t str_m, const char *fmt, ...)
|
||||
int str_l;
|
||||
|
||||
va_start(ap, fmt);
|
||||
str_l = vim_vsnprintf(str, str_m, fmt, ap);
|
||||
str_l = vim_vsnprintf_typval(str, str_m, fmt, ap, NULL);
|
||||
va_end(ap);
|
||||
|
||||
if (str_l < 0) {
|
||||
|
||||
Reference in New Issue
Block a user