]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1440: too many strlen() calls in os_win32.c v9.1.1440
authorJohn Marriott <basilisk@internode.on.net>
Sun, 8 Jun 2025 14:05:53 +0000 (16:05 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 8 Jun 2025 14:05:53 +0000 (16:05 +0200)
commit9cb27a57c86755ae3fabdd028993548a466ac223
treeae58ed9b3b94719d5b3e04f23353a554cdf48867
parent3fa0d3514b928e0b21ef24594785f9104a3ffafd
patch 9.1.1440: too many strlen() calls in os_win32.c

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

The following changes have been made:
- In mch_init_g():
  - refactor to remove calls to STRLEN().
  - use vim_strnsave() instead of vim_strsave().
  - set a flag if vimrun_path is stored in allocated memory so it can be
     freed at exit.
- In mch_exit() free vimrun_path if it was stored in allocated memory.
- In fname_case() make a small optimisation by measuring the length of
  name only if needed.
- In copy_extattr() make a small optimisation by replacing call to
  STRCAT() with STRCPY().

closes: #17462

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