mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
refactor: add xmemcpyz() and use it in place of some xstrlcpy() (#28422)
Problem: Using xstrlcpy() when the exact length of the string to be copied is known is not ideal because it requires adding 1 to the length and an unnecessary strlen(). Solution: Add xmemcpyz() and use it in place of such xstrlcpy() calls.
This commit is contained in:
@@ -2445,7 +2445,7 @@ void path_guess_exepath(const char *argv0, char *buf, size_t bufsize)
|
||||
if (dir_len + 1 > sizeof(NameBuff)) {
|
||||
continue;
|
||||
}
|
||||
xstrlcpy(NameBuff, dir, dir_len + 1);
|
||||
xmemcpyz(NameBuff, dir, dir_len);
|
||||
xstrlcat(NameBuff, PATHSEPSTR, sizeof(NameBuff));
|
||||
xstrlcat(NameBuff, argv0, sizeof(NameBuff));
|
||||
if (os_can_exe(NameBuff, NULL, false)) {
|
||||
|
Reference in New Issue
Block a user