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.
diff --git a/src/spellfile.c b/src/spellfile.c
index b9451ec..6cad202 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -349,8 +349,6 @@
int i;
int n;
int len;
- char_u *save_sourcing_name = sourcing_name;
- linenr_T save_sourcing_lnum = sourcing_lnum;
slang_T *lp = NULL;
int c = 0;
int res;
@@ -393,8 +391,7 @@
lp = old_lp;
// Set sourcing_name, so that error messages mention the file name.
- sourcing_name = fname;
- sourcing_lnum = 0;
+ estack_push(ETYPE_SPELL, fname, 0);
/*
* <HEADER>: <fileID>
@@ -581,8 +578,7 @@
endOK:
if (fd != NULL)
fclose(fd);
- sourcing_name = save_sourcing_name;
- sourcing_lnum = save_sourcing_lnum;
+ estack_pop();
return lp;
}