]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1460: MS-Windows: too many strlen() calls in os_win32.c 17542/head v9.1.1460
authorJohn Marriott <basilisk@internode.on.net>
Sun, 15 Jun 2025 14:50:38 +0000 (16:50 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 15 Jun 2025 14:50:38 +0000 (16:50 +0200)
commite5297e39b3b7fcc1da55ef7869cc0c7714b01bc2
tree38d91be23364b6b4c8670e0d9a762cc3b6b5546c
parentf548ec46e4d8b01d2645ee9598e95fb2de268baa
patch 9.1.1460: MS-Windows: too many strlen() calls in os_win32.c

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

This commit does the following changes:
- in mch_get_exe_name():
  - refactor to remove call to wcsrchr().
  - refactor to replace calls to wcscat() with wcscpy().
  - move variables closer to where they are used.
  - change test to make sure that concatenating path and exe_pathw
    will fit inside the environment string (taking into account that
    path may be NULL).
- in executable_exists():
  - add namelen argument.
  - use string_T to store some strings.
  - refactor to remove calls to STRLEN() (via STRCAT()).
- in mch_getperm():
  - move call to mch_stat() into return statement and drop unneeded
    variable.
- in mch_wrename():
  - refactor to use wide character comparisons.
- some cosmetic code styling changes (removing extraneous spaces, etc).

closes: 17542

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