diff src/spellfile.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 7e7ec935e7c8
children 45eb6f37692e
line wrap: on
line diff
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -349,8 +349,6 @@ spell_load_file(
     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 @@ spell_load_file(
 	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 @@ endFAIL:
 endOK:
     if (fd != NULL)
 	fclose(fd);
-    sourcing_name = save_sourcing_name;
-    sourcing_lnum = save_sourcing_lnum;
+    estack_pop();
 
     return lp;
 }