[PATCH] compositor: Silence compiler warning by declaring resource inside loop

Rob Bradford rob at robster.org.uk
Fri May 18 06:13:03 PDT 2012


From: Rob Bradford <rob at linux.intel.com>

Although resource will be valid when it is used since the entered and left
masks are subsets of the different mask it would be nice not to have a
spurious compiler warning.
---
 src/compositor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 8fd4aa6..ec7928f 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1191,7 +1191,6 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask)
 	uint32_t entered = mask & different;
 	uint32_t left = es->output_mask & different;
 	struct weston_output *output;
-	struct wl_resource *resource;
 	struct wl_client *client = es->surface.resource.client;
 
 	if (es->surface.resource.client == NULL)
@@ -1201,6 +1200,7 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask)
 
 	es->output_mask = mask;
 	wl_list_for_each(output, &es->compositor->output_list, link) {
+		struct wl_resource *resource = NULL;
 		if (1 << output->id & different)
 			resource =
 				find_resource_for_client(&output->resource_list,
-- 
1.7.7.6



More information about the wayland-devel mailing list