aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-02-27 08:44:42 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-02-27 08:55:14 +0800
commite1a3128ec4312f537479bbe4dcd789599ac054fc (patch)
treec0cffbff8425b9377aff95bd9ad0f4a10acda352 /src/nvim/ops.c
parent3cce6570312830dfab9efd9d521125f0049ad55f (diff)
downloadrneovim-e1a3128ec4312f537479bbe4dcd789599ac054fc.tar.gz
rneovim-e1a3128ec4312f537479bbe4dcd789599ac054fc.tar.bz2
rneovim-e1a3128ec4312f537479bbe4dcd789599ac054fc.zip
vim-patch:9.1.1151: too many strlen() calls in getchar.c
Problem: too many strlen() calls in getchar.c Solution: store last inserted and recorded lengths, add functions to retrieve those and use those functions (John Marriott) closes: vim/vim#16720 https://github.com/vim/vim/commit/d3c4b7e9461f90bad7a671c1221d65def9cccc89 Co-authored-by: John Marriott <basilisk@internode.on.net>
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 72c75534d4..f60a6d50c9 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1039,7 +1039,7 @@ int do_record(int c)
// restore the current register name.
yankreg_T *old_y_previous = y_previous;
- retval = stuff_yank(regname, p);
+ retval = stuff_yank(regname, p, get_recorded_len());
y_previous = old_y_previous;
}
@@ -1051,7 +1051,7 @@ int do_record(int c)
/// uppercase). "p" must have been allocated.
///
/// @return FAIL for failure, OK otherwise
-static int stuff_yank(int regname, char *p)
+static int stuff_yank(int regname, char *p, size_t plen)
{
// check for read-only register
if (regname != 0 && !valid_yank_reg(regname, true)) {
@@ -1063,7 +1063,6 @@ static int stuff_yank(int regname, char *p)
return OK;
}
- const size_t plen = strlen(p);
yankreg_T *reg = get_yank_register(regname, YREG_YANK);
if (is_append_register(regname) && reg->y_array != NULL) {
String *pp = &(reg->y_array[reg->y_size - 1]);