diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-16 10:32:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-02-16 11:50:28 +0800 |
commit | e619fb1660595f9e6a0afad8d9a91e37a94f95a3 (patch) | |
tree | 0e188de01b75ff027e5eeecb87aef10f1c26f507 /src/nvim/runtime.c | |
parent | 5dc4eaf386d70b9bbef321a00bcbb5d475f36542 (diff) | |
download | rneovim-e619fb1660595f9e6a0afad8d9a91e37a94f95a3.tar.gz rneovim-e619fb1660595f9e6a0afad8d9a91e37a94f95a3.tar.bz2 rneovim-e619fb1660595f9e6a0afad8d9a91e37a94f95a3.zip |
vim-patch:8.2.0114: info about sourced scripts is scattered
Problem: Info about sourced scripts is scattered.
Solution: Use scriptitem_T for info about a script, including s: variables.
Drop ga_scripts.
https://github.com/vim/vim/commit/7ebcba61b20d25d23109fff73d0346ad44ba1b3b
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/runtime.c')
-rw-r--r-- | src/nvim/runtime.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index cff0f886ce..e8b0492f35 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -1846,10 +1846,13 @@ scriptitem_T *new_script_item(char *const name, scid_T *const sid_out) while (script_items.ga_len < sid) { script_items.ga_len++; SCRIPT_ITEM(script_items.ga_len).sn_name = NULL; + + // Allocate the local script variables to use for this script. + new_script_vars(script_items.ga_len); + SCRIPT_ITEM(script_items.ga_len).sn_prof_on = false; } SCRIPT_ITEM(sid).sn_name = name; - new_script_vars(sid); // Allocate the local script variables to use for this script. return &SCRIPT_ITEM(sid); } @@ -2305,7 +2308,14 @@ void free_scriptnames(void) { profile_reset(); -# define FREE_SCRIPTNAME(item) xfree((item)->sn_name) +# define FREE_SCRIPTNAME(item) \ + do { \ + /* the variables themselves are cleared in evalvars_clear() */ \ + xfree((item)->sn_vars); \ + xfree((item)->sn_name); \ + ga_clear(&(item)->sn_prl_ga); \ + } while (0) \ + GA_DEEP_CLEAR(&script_items, scriptitem_T, FREE_SCRIPTNAME); } #endif |