Mercurial > vim
diff src/map.c @ 18991:847cc7932c42 v8.2.0056
patch 8.2.0056: execution stack is incomplete and inefficient
Commit: https://github.com/vim/vim/commit/1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 29 23:04:25 2019 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 29 Dec 2019 23:15:04 +0100 |
parents | 9e6d5a4abb1c |
children | af1eca322b9e |
line wrap: on
line diff
--- a/src/map.c +++ b/src/map.c @@ -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)