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/sign.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/sign.c')
-rw-r--r-- | src/nvim/sign.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 97164f2234..6a6adbd866 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -1209,27 +1209,27 @@ static void sign_define_cmd(char *sign_name, char *cmdline) if (strncmp(arg, "icon=", 5) == 0) { arg += 5; XFREE_CLEAR(icon); - icon = xstrnsave(arg, (size_t)(p - arg)); + icon = xmemdupz(arg, (size_t)(p - arg)); } else if (strncmp(arg, "text=", 5) == 0) { arg += 5; XFREE_CLEAR(text); - text = xstrnsave(arg, (size_t)(p - arg)); + text = xmemdupz(arg, (size_t)(p - arg)); } else if (strncmp(arg, "linehl=", 7) == 0) { arg += 7; XFREE_CLEAR(linehl); - linehl = xstrnsave(arg, (size_t)(p - arg)); + linehl = xmemdupz(arg, (size_t)(p - arg)); } else if (strncmp(arg, "texthl=", 7) == 0) { arg += 7; XFREE_CLEAR(texthl); - texthl = xstrnsave(arg, (size_t)(p - arg)); + texthl = xmemdupz(arg, (size_t)(p - arg)); } else if (strncmp(arg, "culhl=", 6) == 0) { arg += 6; XFREE_CLEAR(culhl); - culhl = xstrnsave(arg, (size_t)(p - arg)); + culhl = xmemdupz(arg, (size_t)(p - arg)); } else if (strncmp(arg, "numhl=", 6) == 0) { arg += 6; XFREE_CLEAR(numhl); - numhl = xstrnsave(arg, (size_t)(p - arg)); + numhl = xmemdupz(arg, (size_t)(p - arg)); } else { semsg(_(e_invarg2), arg); failed = true; |