diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-11-10 08:39:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 08:39:21 +0800 |
commit | cd63a9addd6e1114c3524fa041ece560550cfe7b (patch) | |
tree | 846797f471b5de4c230838620ceaeda860de9e17 /src/nvim/spell.c | |
parent | ae8ca79920a8d0e928ac1502a10d1d063a06cae5 (diff) | |
download | rneovim-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/spell.c')
-rw-r--r-- | src/nvim/spell.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 4b1f8afb15..864a55b12b 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2257,7 +2257,7 @@ static void use_midword(slang_T *lp, win_T *wp) wp->w_s->b_spell_ismw[c] = true; } else if (wp->w_s->b_spell_ismw_mb == NULL) { // First multi-byte char in "b_spell_ismw_mb". - wp->w_s->b_spell_ismw_mb = xstrnsave(p, (size_t)l); + wp->w_s->b_spell_ismw_mb = xmemdupz(p, (size_t)l); } else { // Append multi-byte chars to "b_spell_ismw_mb". const int n = (int)strlen(wp->w_s->b_spell_ismw_mb); |