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:
zeertzjq
2023-02-16 11:00:48 +08:00
parent e619fb1660
commit 0cbbe27e93
5 changed files with 34 additions and 36 deletions

View File

@@ -2524,7 +2524,7 @@ static char *get_scriptnames_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx)
return NULL;
}
scriptitem_T *si = &SCRIPT_ITEM(idx + 1);
scriptitem_T *si = SCRIPT_ITEM(idx + 1);
home_replace(NULL, si->sn_name, NameBuff, MAXPATHL, true);
return NameBuff;
}