mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
refactor: change some xstrndup() and xstrnsave() to xmemdupz() (#25959)
When the given length is exactly the number of bytes to copy, xmemdupz() makes the intention clearer.
This commit is contained in:
@@ -2110,10 +2110,10 @@ void ex_loadkeymap(exarg_T *eap)
|
||||
if ((*p != '"') && (*p != NUL)) {
|
||||
kmap_T *kp = GA_APPEND_VIA_PTR(kmap_T, &curbuf->b_kmap_ga);
|
||||
s = skiptowhite(p);
|
||||
kp->from = xstrnsave(p, (size_t)(s - p));
|
||||
kp->from = xmemdupz(p, (size_t)(s - p));
|
||||
p = skipwhite(s);
|
||||
s = skiptowhite(p);
|
||||
kp->to = xstrnsave(p, (size_t)(s - p));
|
||||
kp->to = xmemdupz(p, (size_t)(s - p));
|
||||
|
||||
if ((strlen(kp->from) + strlen(kp->to) >= KMAP_LLEN)
|
||||
|| (*kp->from == NUL)
|
||||
|
Reference in New Issue
Block a user