mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 09:18:19 +00:00
vim-patch:8.2.0154: reallocating the list of scripts is inefficient
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.
21b9e9773d
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -109,7 +109,7 @@ static hashtab_T compat_hashtab;
|
||||
/// Used for checking if local variables or arguments used in a lambda.
|
||||
bool *eval_lavars_used = NULL;
|
||||
|
||||
#define SCRIPT_SV(id) (SCRIPT_ITEM(id).sn_vars)
|
||||
#define SCRIPT_SV(id) (SCRIPT_ITEM(id)->sn_vars)
|
||||
#define SCRIPT_VARS(id) (SCRIPT_SV(id)->sv_dict.dv_hashtab)
|
||||
|
||||
static int echo_attr = 0; // attributes used for ":echo"
|
||||
@@ -7177,7 +7177,7 @@ void new_script_vars(scid_T id)
|
||||
{
|
||||
scriptvar_T *sv = xcalloc(1, sizeof(scriptvar_T));
|
||||
init_var_dict(&sv->sv_dict, &sv->sv_var, VAR_SCOPE);
|
||||
SCRIPT_ITEM(id).sn_vars = sv;
|
||||
SCRIPT_ITEM(id)->sn_vars = sv;
|
||||
}
|
||||
|
||||
/// Initialize dictionary "dict" as a scope and set variable "dict_var" to
|
||||
|
Reference in New Issue
Block a user