mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	wayland-server: Add a wl_resource_for_each_safe macro
A version of wl_resource_for_each that is safe for iteration when items in the list are removed.
This commit is contained in:
		
							parent
							
								
									a27b730490
								
							
						
					
					
						commit
						656f3ea5b3
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -350,6 +350,14 @@ wl_resource_get_destroy_listener(struct wl_resource *resource,
 | 
			
		|||
	     wl_resource_get_link(resource) != (list);				\
 | 
			
		||||
	     resource = wl_resource_from_link(wl_resource_get_link(resource)->next))
 | 
			
		||||
 | 
			
		||||
#define wl_resource_for_each_safe(resource, tmp, list)					\
 | 
			
		||||
	for (resource = 0, tmp = 0,							\
 | 
			
		||||
	     resource = wl_resource_from_link((list)->next),	\
 | 
			
		||||
	     tmp = wl_resource_from_link((list)->next->next);	\
 | 
			
		||||
	     wl_resource_get_link(resource) != (list);				\
 | 
			
		||||
	     resource = tmp,							\
 | 
			
		||||
	     tmp = wl_resource_from_link(wl_resource_get_link(resource)->next))
 | 
			
		||||
 | 
			
		||||
struct wl_shm_buffer;
 | 
			
		||||
 | 
			
		||||
struct wl_shm_buffer *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue