]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1887: string handling in strings.c can be improved v9.1.1887
authorJohn Marriott <basilisk@internode.on.net>
Tue, 28 Oct 2025 20:56:47 +0000 (20:56 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 28 Oct 2025 20:56:47 +0000 (20:56 +0000)
commit110656ba607d22bbd6b1b25f0c05a1f7bad205c0
tree98dac6aac0be24985677bce6945fe4c2b95c78b3
parent469f870c5e06cb4c1f4b78aa1a7cc354059631d0
patch 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: #18617

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/strings.c
src/version.c