From a8ecc1ae6d82d80f63ed75ac5c882520843905ae Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 23 Jun 2022 19:19:20 +0200 Subject: perf(map): avoid extraneous heap allocations when setting mappings - don't immediately vim_strsave and then xfree a heap buffer. - allow replace_termcodes to take in a buffer instead of allocating it - grug! memory allocation bad! --- src/nvim/option.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/option.c') diff --git a/src/nvim/option.c b/src/nvim/option.c index f870f07e15..633fbe0517 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3025,6 +3025,7 @@ ambw_end: } else if (varp == &p_pt) { // 'pastetoggle': translate key codes like in a mapping if (*p_pt) { + p = NULL; (void)replace_termcodes((char *)p_pt, STRLEN(p_pt), (char **)&p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL, -- cgit