[PATCH] compositor: Silence compiler warning by declaring resource inside loop
Kristian Høgsberg
hoegsberg at gmail.com
Fri May 18 06:51:35 PDT 2012
On Fri, May 18, 2012 at 02:13:03PM +0100, Rob Bradford wrote:
> 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.
That's odd, I stopped getting that warning. I tried setting entered
to random)() just to see if gcc 4.7 got smart enough to figure out
that resource isn't used uninitialized, but that didn't trigger the
warning either.
Anyway, I committed the patch but changed it to just set resource to
NULL where it's currently declared.
thanks,
Kristian
> ---
> 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
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list