diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-06-30 03:57:59 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-06-30 03:57:59 -0400 |
commit | e4abb9e09a0588177f99235526d3fab5d64345b2 (patch) | |
tree | 28b0265ba05af45cdaa983462564fbba186f135b /src/nvim/eval.c | |
parent | 2ddeb74202633784b9ebb4b963e2df06ed7332df (diff) | |
parent | 5ed74cfb7c67f79441343ec90548f333dad1729b (diff) | |
download | rneovim-e4abb9e09a0588177f99235526d3fab5d64345b2.tar.gz rneovim-e4abb9e09a0588177f99235526d3fab5d64345b2.tar.bz2 rneovim-e4abb9e09a0588177f99235526d3fab5d64345b2.zip |
Merge #830 'GA_APPEND() and GA_APPEND_VIA_PTR()'
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 3abc148e8f..15967f484b 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5290,8 +5290,7 @@ list_join_inner ( len = (int)STRLEN(s); sumlen += len; - ga_grow(join_gap, 1); - p = ((join_T *)join_gap->ga_data) + (join_gap->ga_len++); + p = GA_APPEND_VIA_PTR(join_T, join_gap); if (tofree != NULL || s != numbuf) { p->s = s; p->tofree = tofree; @@ -10218,11 +10217,9 @@ static void f_inputrestore(typval_T *argvars, typval_T *rettv) */ static void f_inputsave(typval_T *argvars, typval_T *rettv) { - /* Add an entry to the stack of typeahead storage. */ - ga_grow(&ga_userinput, 1); - save_typeahead((tasave_T *)(ga_userinput.ga_data) - + ga_userinput.ga_len); - ++ga_userinput.ga_len; + // Add an entry to the stack of typeahead storage. + tasave_T *p = GA_APPEND_VIA_PTR(tasave_T, &ga_userinput); + save_typeahead(p); } /* @@ -14420,8 +14417,7 @@ error: } } - /* add a terminating NUL */ - ga_grow(&ga, 1); + // add a terminating NUL ga_append(&ga, NUL); rettv->vval.v_string = ga.ga_data; @@ -17640,8 +17636,7 @@ script_autoload ( else { /* Remember the name if it wasn't loaded already. */ if (i == ga_loaded.ga_len) { - ga_grow(&ga_loaded, 1); - ((char_u **)ga_loaded.ga_data)[ga_loaded.ga_len++] = scriptname; + GA_APPEND(char_u *, &ga_loaded, scriptname); tofree = NULL; } |