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.
diff --git a/src/eval.c b/src/eval.c
index 72f9324..a9d0c7d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -692,7 +692,7 @@
if (current_sctx.sc_version == SCRIPT_VERSION_VIM9 && *p == ':')
{
- scriptitem_T *si = &SCRIPT_ITEM(current_sctx.sc_sid);
+ scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid);
char_u *tp = skipwhite(p + 1);
// parse the type after the name