summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-29 23:04:25 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-29 23:04:25 +0100
commit1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 (patch)
tree8f5dc27f3eeea927ad3ca8de42fe0df06a041dd5 /src/buffer.c
parent257a396879ff67a0482841a39237f30a8e1e27c5 (diff)
downloadvim-git-1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506.tar.gz
patch 8.2.0056: execution stack is incomplete and inefficientv8.2.0056
Problem: Execution stack is incomplete and inefficient. Solution: Introduce a proper execution stack and use it instead of sourcing_name/sourcing_lnum. Create a string only when used.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 2502dee62..dd3593fb5 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5279,8 +5279,6 @@ chk_modeline(
int vers;
int end;
int retval = OK;
- char_u *save_sourcing_name;
- linenr_T save_sourcing_lnum;
#ifdef FEAT_EVAL
sctx_T save_current_sctx;
#endif
@@ -5325,10 +5323,8 @@ chk_modeline(
if (linecopy == NULL)
return FAIL;
- save_sourcing_lnum = sourcing_lnum;
- save_sourcing_name = sourcing_name;
- sourcing_lnum = lnum; // prepare for emsg()
- sourcing_name = (char_u *)"modelines";
+ // prepare for emsg()
+ estack_push(ETYPE_MODELINE, (char_u *)"modelines", lnum);
end = FALSE;
while (end == FALSE)
@@ -5371,7 +5367,7 @@ chk_modeline(
save_current_sctx = current_sctx;
current_sctx.sc_sid = SID_MODELINE;
current_sctx.sc_seq = 0;
- current_sctx.sc_lnum = 0;
+ current_sctx.sc_lnum = lnum;
current_sctx.sc_version = 1;
#endif
// Make sure no risky things are executed as a side effect.
@@ -5389,9 +5385,7 @@ chk_modeline(
s = e + 1; // advance to next part
}
- sourcing_lnum = save_sourcing_lnum;
- sourcing_name = save_sourcing_name;
-
+ estack_pop();
vim_free(linecopy);
}
return retval;