summaryrefslogtreecommitdiffstats
path: root/src/popupmenu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-06 22:13:01 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-06 22:13:01 +0200
commit00d253e2b2f435a5386582c3f857008e7ac355c2 (patch)
tree71bbea4e4c6efa593a85266e445d82377a65f454 /src/popupmenu.c
parentee4e0c1e9a81cb5d96e0060203a9033c2f28588e (diff)
patch 8.2.0523: loops are repeatedv8.2.0523
Problem: Loops are repeated. Solution: Use FOR_ALL_ macros. (Yegappan Lakshmanan, closes #5882)
Diffstat (limited to 'src/popupmenu.c')
-rw-r--r--src/popupmenu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c
index c57681c9e9..c6214d290b 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -1379,7 +1379,7 @@ pum_execute_menu(vimmenu_T *menu, int mode)
int idx = 0;
exarg_T ea;
- for (mp = menu->children; mp != NULL; mp = mp->next)
+ FOR_ALL_CHILD_MENUS(menu, mp)
if ((mp->modes & mp->enabled & mode) && idx++ == pum_selected)
{
vim_memset(&ea, 0, sizeof(ea));
@@ -1407,7 +1407,7 @@ pum_show_popupmenu(vimmenu_T *menu)
pum_size = 0;
mode = get_menu_mode_flag();
- for (mp = menu->children; mp != NULL; mp = mp->next)
+ FOR_ALL_CHILD_MENUS(menu, mp)
if (menu_is_separator(mp->dname)
|| (mp->modes & mp->enabled & mode))
++pum_size;
@@ -1424,7 +1424,7 @@ pum_show_popupmenu(vimmenu_T *menu)
if (array == NULL)
return;
- for (mp = menu->children; mp != NULL; mp = mp->next)
+ FOR_ALL_CHILD_MENUS(menu, mp)
if (menu_is_separator(mp->dname))
array[idx++].pum_text = (char_u *)"";
else if (mp->modes & mp->enabled & mode)