mirror of
https://github.com/neovim/neovim.git
synced 2026-08-31 03:13:48 +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:
@@ -198,7 +198,7 @@ char *get_xdg_home(const XDGVarType idx)
|
||||
assert(appname_len < (IOSIZE - sizeof("-data")));
|
||||
|
||||
if (dir) {
|
||||
xstrlcpy(IObuff, appname, appname_len + 1);
|
||||
xmemcpyz(IObuff, appname, appname_len);
|
||||
#if defined(MSWIN)
|
||||
if (idx == kXDGDataHome || idx == kXDGStateHome) {
|
||||
xstrlcat(IObuff, "-data", IOSIZE);
|
||||
|
||||
Reference in New Issue
Block a user