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!
This commit is contained in:
bfredl
2022-06-23 19:19:20 +02:00
parent 614fd3a883
commit a8ecc1ae6d
4 changed files with 74 additions and 49 deletions

View File

@@ -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,