diff options
author | Fabian Viöl <f.vioel@googlemail.com> | 2021-05-03 22:53:13 +0200 |
---|---|---|
committer | Fabian Viöl <f.vioel@googlemail.com> | 2021-05-03 22:53:13 +0200 |
commit | c9567704b70fb1d6aba20ef909501b5ac0277d3d (patch) | |
tree | 1040ed284f4ef3deefabee5804a0be9078d998d7 | |
parent | ad811444424f573c4dc10b203f8f42adb3c5fdf4 (diff) | |
download | rneovim-c9567704b70fb1d6aba20ef909501b5ac0277d3d.tar.gz rneovim-c9567704b70fb1d6aba20ef909501b5ac0277d3d.tar.bz2 rneovim-c9567704b70fb1d6aba20ef909501b5ac0277d3d.zip |
get_str_line: Replace grow_array usage
A single xmemdupz is sufficient, as it is already
zero-terminating the string
-rw-r--r-- | src/nvim/ex_cmds2.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 317ca465e1..7f28c001f9 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2720,12 +2720,9 @@ static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat) i++; } size_t line_length = i - p->offset; - garray_T ga; - ga_init(&ga, (int)sizeof(char_u), (int)line_length); - ga_concat_len(&ga, (char *)p->buf + p->offset, line_length); - ga_append(&ga, '\0'); + char_u *buf = xmemdupz(p->buf + p->offset, line_length); p->offset = i + 1; - return ga.ga_data; + return buf; } static int source_using_linegetter(void *cookie, |