mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38: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:
@@ -630,7 +630,7 @@ void set_init_3(void)
|
||||
|
||||
size_t len = 0;
|
||||
char *p = (char *)invocation_path_tail(p_sh, &len);
|
||||
p = xstrnsave(p, len);
|
||||
p = xmemdupz(p, len);
|
||||
|
||||
{
|
||||
//
|
||||
@@ -5749,7 +5749,7 @@ int ExpandSettingSubtract(expand_T *xp, regmatch_T *regmatch, int *numMatches, c
|
||||
// If more than one flags, split the flags up and expose each
|
||||
// character as individual choice.
|
||||
for (char *flag = option_val; *flag != NUL; flag++) {
|
||||
(*matches)[count++] = xstrnsave(flag, 1);
|
||||
(*matches)[count++] = xmemdupz(flag, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user