1
0
forked from aniani/vim

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:
Bram Moolenaar
2019-12-29 23:04:25 +01:00
parent 257a396879
commit 1a47ae32cd
23 changed files with 385 additions and 240 deletions

View File

@@ -697,7 +697,7 @@ do_map(
#ifdef FEAT_EVAL
mp->m_expr = expr;
mp->m_script_ctx = current_sctx;
mp->m_script_ctx.sc_lnum += sourcing_lnum;
mp->m_script_ctx.sc_lnum += SOURCING_LNUM;
#endif
did_it = TRUE;
}
@@ -796,7 +796,7 @@ do_map(
#ifdef FEAT_EVAL
mp->m_expr = expr;
mp->m_script_ctx = current_sctx;
mp->m_script_ctx.sc_lnum += sourcing_lnum;
mp->m_script_ctx.sc_lnum += SOURCING_LNUM;
#endif
// add the new entry in front of the abbrlist or maphash[] list
@@ -1915,14 +1915,13 @@ check_map_keycodes(void)
char_u *p;
int i;
char_u buf[3];
char_u *save_name;
int abbr;
int hash;
buf_T *bp;
validate_maphash();
save_name = sourcing_name;
sourcing_name = (char_u *)"mappings"; // avoids giving error messages
// avoids giving error messages
estack_push(ETYPE_INTERNAL, (char_u *)"mappings", 0);
// Do this once for each buffer, and then once for global
// mappings/abbreviations with bp == NULL
@@ -1979,7 +1978,7 @@ check_map_keycodes(void)
if (bp == NULL)
break;
}
sourcing_name = save_name;
estack_pop();
}
#if defined(FEAT_EVAL) || defined(PROTO)