summaryrefslogtreecommitdiff
path: root/src/evalvars.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-26 19:26:46 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-26 19:26:46 +0100
commit21b9e9773d64de40994f8762173bdd8befa6acf7 (patch)
tree4aa50f453c1dda97881a6bb3153e2246bc4a95ed /src/evalvars.c
parentb3de5114acdc5859cf068d5fde9d7cb2bb34aa31 (diff)
downloadvim-git-21b9e9773d64de40994f8762173bdd8befa6acf7.tar.gz
patch 8.2.0154: reallocating the list of scripts is inefficientv8.2.0154
Problem: Reallocating the list of scripts is inefficient. Solution: Instead of using a growarray of scriptitem_T, store pointers and allocate each scriptitem_T separately. Also avoids that the growarray pointers change when sourcing a new script.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r--src/evalvars.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index ebb30dd22..866682b97 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -2289,7 +2289,7 @@ get_var_tv(
// imported variable from another script
if (import != NULL)
{
- scriptitem_T *si = &SCRIPT_ITEM(import->imp_sid);
+ scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data)
+ import->imp_var_vals_idx;
tv = sv->sv_tv;
@@ -2571,7 +2571,7 @@ new_script_vars(scid_T id)
if (sv == NULL)
return;
init_var_dict(&sv->sv_dict, &sv->sv_var, VAR_SCOPE);
- SCRIPT_ITEM(id).sn_vars = sv;
+ SCRIPT_ITEM(id)->sn_vars = sv;
}
/*
@@ -2876,7 +2876,7 @@ set_var_const(
if (is_script_local && current_sctx.sc_version == SCRIPT_VERSION_VIM9)
{
- scriptitem_T *si = &SCRIPT_ITEM(current_sctx.sc_sid);
+ scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
// Store a pointer to the typval_T, so that it can be found by
// index instead of using a hastab lookup.