aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-01 17:34:19 +0800
committerGitHub <noreply@github.com>2024-11-01 09:34:19 +0000
commitcbd8b2c1622e0c1cb4d38b65730e259eb6c100df (patch)
tree3300c416bd92aa912fcb2084853130d1f758331e /src/nvim/terminal.c
parent9b357e30fdd0a575480182872331fdb87e9cc331 (diff)
downloadrneovim-cbd8b2c1622e0c1cb4d38b65730e259eb6c100df.tar.gz
rneovim-cbd8b2c1622e0c1cb4d38b65730e259eb6c100df.tar.bz2
rneovim-cbd8b2c1622e0c1cb4d38b65730e259eb6c100df.zip
vim-patch:9.1.0824: too many strlen() calls in register.c (#31022)
Problem: too many strlen() calls in register.c Solution: refactor code, add string_T struct to keep track of string lengths (John Marriott) closes: vim/vim#15952 https://github.com/vim/vim/commit/79f6ffd388299ef3b1c95cbe658785e6e66df144 Co-authored-by: John Marriott <basilisk@internode.on.net>
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index f444021b90..5ff7f721ba 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -895,13 +895,13 @@ static bool is_filter_char(int c)
return !!(tpf_flags & flag);
}
-void terminal_paste(int count, char **y_array, size_t y_size)
+void terminal_paste(int count, String *y_array, size_t y_size)
{
if (y_size == 0) {
return;
}
vterm_keyboard_start_paste(curbuf->terminal->vt);
- size_t buff_len = strlen(y_array[0]);
+ size_t buff_len = y_array[0].size;
char *buff = xmalloc(buff_len);
for (int i = 0; i < count; i++) {
// feed the lines to the terminal
@@ -914,13 +914,13 @@ void terminal_paste(int count, char **y_array, size_t y_size)
terminal_send(curbuf->terminal, "\n", 1);
#endif
}
- size_t len = strlen(y_array[j]);
+ size_t len = y_array[j].size;
if (len > buff_len) {
buff = xrealloc(buff, len);
buff_len = len;
}
char *dst = buff;
- char *src = y_array[j];
+ char *src = y_array[j].data;
while (*src != NUL) {
len = (size_t)utf_ptr2len(src);
int c = utf_ptr2char(src);