From 45e7814e6aa8aacd8772056863d13770d4e30b48 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Wed, 25 Jun 2014 22:03:58 -0300 Subject: Introduce GA_APPEND() This macro is used to append an element to a growable array. It replaces this common idiom: ga_grow(&ga, 1); ((item_type *)ga.ga_data)[ga.ga_len] = item; ++ga.ga_len; --- src/nvim/undo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/undo.c') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 37fa150aee..8fe05290c2 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2249,7 +2249,6 @@ void ex_undolist(exarg_T *eap) while (uhp != NULL) { if (uhp->uh_prev.ptr == NULL && uhp->uh_walk != nomark && uhp->uh_walk != mark) { - ga_grow(&ga, 1); vim_snprintf((char *)IObuff, IOSIZE, "%6ld %7ld ", uhp->uh_seq, changes); u_add_time(IObuff + STRLEN(IObuff), IOSIZE - STRLEN(IObuff), @@ -2260,7 +2259,7 @@ void ex_undolist(exarg_T *eap) vim_snprintf_add((char *)IObuff, IOSIZE, " %3ld", uhp->uh_save_nr); } - ((char_u **)(ga.ga_data))[ga.ga_len++] = vim_strsave(IObuff); + GA_APPEND(char_u *, &ga, vim_strsave(IObuff)); } uhp->uh_walk = mark; -- cgit