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/ex_docmd.c b/src/ex_docmd.c
index 0e6b8dc..c0ed1c8 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2496,7 +2496,7 @@
#ifdef FEAT_EVAL
// Set flag that any command was executed, used by ex_vim9script().
if (getline_equal(ea.getline, ea.cookie, getsourceline))
- SCRIPT_ITEM(current_sctx.sc_sid).sn_had_command = TRUE;
+ SCRIPT_ITEM(current_sctx.sc_sid)->sn_had_command = TRUE;
/*
* If the command just executed called do_cmdline(), any throw or ":return"