mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
Introduce ga_append_via_ptr() and GA_APPEND_VIA_PTR()
Similar to GA_APPEND(). Replaces this pattern: ga_grow(&ga, 1); item_type *p = ((item_type *)ga.ga_data) + ga.ga_len; p->field1 = v1; p->field2 = v2; ga.ga_len++;
This commit is contained in:

committed by
Justin M. Keyes

parent
45e7814e6a
commit
5ed74cfb7c
@@ -1037,10 +1037,9 @@ static char_u *get_loop_line(int c, void *cookie, int indent)
|
||||
*/
|
||||
static void store_loop_line(garray_T *gap, char_u *line)
|
||||
{
|
||||
ga_grow(gap, 1);
|
||||
((wcmd_T *)(gap->ga_data))[gap->ga_len].line = vim_strsave(line);
|
||||
((wcmd_T *)(gap->ga_data))[gap->ga_len].lnum = sourcing_lnum;
|
||||
++gap->ga_len;
|
||||
wcmd_T *p = GA_APPEND_VIA_PTR(wcmd_T, gap);
|
||||
p->line = vim_strsave(line);
|
||||
p->lnum = sourcing_lnum;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user