mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.0056: execution stack is incomplete and inefficient
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.
This commit is contained in:
14
src/buffer.c
14
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;
|
||||
|
Reference in New Issue
Block a user