aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorraichoo <raichoo@googlemail.com>2017-03-11 10:42:07 +0100
committerraichoo <raichoo@googlemail.com>2017-03-19 21:14:11 +0100
commit1e33c886856abcdac13c3eb368c127bda40e1e84 (patch)
tree93f2b8112ea2ead9b6b466635d366e97b5d26c1d /src/nvim/ops.c
parente888864c28033546b827c07d9dd095348fff23bd (diff)
downloadrneovim-1e33c886856abcdac13c3eb368c127bda40e1e84.tar.gz
rneovim-1e33c886856abcdac13c3eb368c127bda40e1e84.tar.bz2
rneovim-1e33c886856abcdac13c3eb368c127bda40e1e84.zip
vim-patch:7.4.2333
Problem: Outdated comments in test. Solution: Cleanup normal mode test. (Christian Brabandt) https://github.com/vim/vim/commit/31845093b7f1b33e0c7e9e592bef65528674a1f2
Diffstat (limited to 'src/nvim/ops.c')
-rw-r--r--src/nvim/ops.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 1e4d392754..3a682b6f96 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3847,6 +3847,7 @@ fex_format (
int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
OPT_LOCAL);
int r;
+ char_u *fex;
/*
* Set v:lnum to the first line number and v:count to the number of lines.
@@ -3856,16 +3857,22 @@ fex_format (
set_vim_var_nr(VV_COUNT, (varnumber_T)count);
set_vim_var_char(c);
+ // Make a copy, the option could be changed while calling it.
+ fex = vim_strsave(curbuf->b_p_fex);
+ if (fex == NULL) {
+ return 0;
+ }
/*
* Evaluate the function.
*/
if (use_sandbox)
++sandbox;
- r = eval_to_number(curbuf->b_p_fex);
+ r = (int)eval_to_number(fex);
if (use_sandbox)
--sandbox;
set_vim_var_string(VV_CHAR, NULL, -1);
+ xfree(fex);
return r;
}