mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Centralize freeing of action lists
Reduces some code duplication and makes it easier to extend struct action
This commit is contained in:
		
							parent
							
								
									8e9643a855
								
							
						
					
					
						commit
						f0a3f365e5
					
				
					 4 changed files with 14 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -330,17 +330,12 @@ void
 | 
			
		|||
menu_finish(void)
 | 
			
		||||
{
 | 
			
		||||
	struct menu *menu;
 | 
			
		||||
	struct action *action, *action_tmp;
 | 
			
		||||
	for (int i = 0; i < nr_menus; ++i) {
 | 
			
		||||
		menu = menus + i;
 | 
			
		||||
		struct menuitem *item, *next;
 | 
			
		||||
		wl_list_for_each_safe(item, next, &menu->menuitems, link) {
 | 
			
		||||
			wl_list_remove(&item->link);
 | 
			
		||||
			wl_list_for_each_safe(action, action_tmp, &item->actions, link) {
 | 
			
		||||
				wl_list_remove(&action->link);
 | 
			
		||||
				zfree(action->arg);
 | 
			
		||||
				zfree(action);
 | 
			
		||||
			}
 | 
			
		||||
			action_list_free(&item->actions);
 | 
			
		||||
			free(item);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue