aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2014-07-13 11:10:27 +0400
committerZyX <kp-pav@yandex.ru>2016-04-18 02:43:43 +0300
commitebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3 (patch)
tree0bae55f8b469efbef6df94dd16394ea334b22a55 /src/nvim/eval.c
parent83c683f5e15867c2e2889442860e91fd1074b4e1 (diff)
downloadrneovim-ebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3.tar.gz
rneovim-ebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3.tar.bz2
rneovim-ebabdff5cd24f2d30ab35051d1d65f7c29fa3dd3.zip
keymap: Make replace_termcodes and friends accept length and cpo_flags
Reasons: - One does not have to do `s[len] = NUL` to work with these functions if they do not need to replace the whole string: thus `s` may be const. - One does not have to save/restore p_cpo to work with them.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 0d6e3d3ca3..1c76847037 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -4719,13 +4719,14 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
++name;
break;
- /* Special key, e.g.: "\<C-W>" */
- case '<': extra = trans_special(&p, name, TRUE);
+ // Special key, e.g.: "\<C-W>"
+ case '<':
+ extra = trans_special((const char_u **) &p, STRLEN(p), name, true);
if (extra != 0) {
name += extra;
break;
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
default: MB_COPY_CHAR(p, name);
break;
@@ -12319,8 +12320,9 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
mode = get_map_mode(&which, 0);
- keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
- rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
+ keys = replace_termcodes(keys, STRLEN(keys), &keys_buf, true, true, false,
+ CPO_TO_CPO_FLAGS);
+ rhs = check_map(keys, mode, exact, false, abbr, &mp, &buffer_local);
xfree(keys_buf);
if (!get_dict) {