mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +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:
@@ -1617,7 +1617,7 @@ static void foldAddMarker(buf_T *buf, pos_T pos, const char *marker, size_t mark
|
||||
STRCPY(newline, line);
|
||||
// Append the marker to the end of the line
|
||||
if (p == NULL || line_is_comment) {
|
||||
xstrlcpy(newline + line_len, marker, markerlen + 1);
|
||||
xmemcpyz(newline + line_len, marker, markerlen);
|
||||
added = markerlen;
|
||||
} else {
|
||||
STRCPY(newline + line_len, cms);
|
||||
|
Reference in New Issue
Block a user