patch 8.2.4040: keeping track of allocated lines is too complicated
Problem: Keeping track of allocated lines in user functions is too
complicated.
Solution: Instead of freeing individual lines keep them all until the end.
diff --git a/src/usercmd.c b/src/usercmd.c
index de985f8..40790a1 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1021,7 +1021,7 @@
char_u *line = NULL;
ga_init2(&ga, sizeof(char_u *), 10);
- if (ga_add_string(&ga, p) == FAIL)
+ if (ga_copy_string(&ga, p) == FAIL)
return retp;
// If the argument ends in "}" it must have been concatenated already
@@ -1038,7 +1038,7 @@
emsg(_(e_missing_rcurly));
break;
}
- if (ga_add_string(&ga, line) == FAIL)
+ if (ga_copy_string(&ga, line) == FAIL)
break;
if (*skipwhite(line) == '}')
break;