summaryrefslogtreecommitdiffstats
path: root/src/globals.h
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/globals.h
parent257a396879ff67a0482841a39237f30a8e1e27c5 (diff)
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/globals.h')
-rw-r--r--src/globals.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/globals.h b/src/globals.h
index 87f7b0be54..acdce70968 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -266,8 +266,15 @@ EXTERN int lines_left INIT(= -1); // lines left for listing
EXTERN int msg_no_more INIT(= FALSE); // don't use more prompt, truncate
// messages
-EXTERN char_u *sourcing_name INIT( = NULL);// name of error message source
-EXTERN linenr_T sourcing_lnum INIT(= 0); // line number of the source file
+/*
+ * Stack of execution contexts. Each entry is an estack_T.
+ * Current context is at ga_len - 1.
+ */
+EXTERN garray_T exestack INIT(= {0 COMMA 0 COMMA sizeof(estack_T) COMMA 50 COMMA NULL});
+// name of error message source
+#define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name)
+// line number in the message source or zero
+#define SOURCING_LNUM (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_lnum)
#ifdef FEAT_EVAL
EXTERN int ex_nesting_level INIT(= 0); // nesting level