aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-10 08:39:21 +0800
committerGitHub <noreply@github.com>2023-11-10 08:39:21 +0800
commitcd63a9addd6e1114c3524fa041ece560550cfe7b (patch)
tree846797f471b5de4c230838620ceaeda860de9e17 /src/nvim/option.c
parentae8ca79920a8d0e928ac1502a10d1d063a06cae5 (diff)
downloadrneovim-cd63a9addd6e1114c3524fa041ece560550cfe7b.tar.gz
rneovim-cd63a9addd6e1114c3524fa041ece560550cfe7b.tar.bz2
rneovim-cd63a9addd6e1114c3524fa041ece560550cfe7b.zip
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.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b44dda67d6..7005b63cac 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -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);
}
}