diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-12-11 13:05:37 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-12-11 20:22:37 -0300 |
commit | e11a5699be83684294c8c235a5f5030e12666206 (patch) | |
tree | fa092586a053b42d83052f51b9baac8f36b29817 /src/nvim/menu.c | |
parent | 8ee5659d83383d857039f8fc58d7ebc21df27905 (diff) | |
download | rneovim-e11a5699be83684294c8c235a5f5030e12666206.tar.gz rneovim-e11a5699be83684294c8c235a5f5030e12666206.tar.bz2 rneovim-e11a5699be83684294c8c235a5f5030e12666206.zip |
Use GA_DEEP_CLEAR where appropriate
Diffstat (limited to 'src/nvim/menu.c')
-rw-r--r-- | src/nvim/menu.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 1573aaae84..b31b6c1cec 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -1424,6 +1424,12 @@ typedef struct { static garray_T menutrans_ga = GA_EMPTY_INIT_VALUE; +#define FREE_MENUTRANS(mt) \ + menutrans_T* _mt = (mt); \ + free(_mt->from); \ + free(_mt->from_noamp); \ + free(_mt->to) + /* * ":menutrans". * This function is also defined without the +multi_lang feature, in which @@ -1441,13 +1447,8 @@ void ex_menutranslate(exarg_T *eap) * ":menutrans clear": clear all translations. */ if (STRNCMP(arg, "clear", 5) == 0 && ends_excmd(*skipwhite(arg + 5))) { - menutrans_T *tp = (menutrans_T *)menutrans_ga.ga_data; - for (int i = 0; i < menutrans_ga.ga_len; ++i) { - free(tp[i].from); - free(tp[i].from_noamp); - free(tp[i].to); - } - ga_clear(&menutrans_ga); + GA_DEEP_CLEAR(&menutrans_ga, menutrans_T, FREE_MENUTRANS); + /* Delete all "menutrans_" global variables. */ del_menutrans_vars(); } else { |