diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-01-08 15:39:39 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-08 15:39:39 +0000 |
commit | 9f1a39a5d1cd7989ada2d1cb32f97d84360e050f (patch) | |
tree | 9ea5c2c61d570af5fa2cee2e1a7ef6d6d107569e /src/usercmd.c | |
parent | 67ffb417861a90fd2c1b215a42fd230272ed94cb (diff) | |
download | vim-git-9f1a39a5d1cd7989ada2d1cb32f97d84360e050f.tar.gz |
patch 8.2.4040: keeping track of allocated lines is too complicatedv8.2.4040
Problem: Keeping track of allocated lines in user functions is too
complicated.
Solution: Instead of freeing individual lines keep them all until the end.
Diffstat (limited to 'src/usercmd.c')
-rw-r--r-- | src/usercmd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/usercmd.c b/src/usercmd.c index de985f8a2..40790a1f5 100644 --- a/src/usercmd.c +++ b/src/usercmd.c @@ -1021,7 +1021,7 @@ may_get_cmd_block(exarg_T *eap, char_u *p, char_u **tofree, int *flags) 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 @@ may_get_cmd_block(exarg_T *eap, char_u *p, char_u **tofree, int *flags) emsg(_(e_missing_rcurly)); break; } - if (ga_add_string(&ga, line) == FAIL) + if (ga_copy_string(&ga, line) == FAIL) break; if (*skipwhite(line) == '}') break; |