[PATCH] wayland-server: Fix a uninitialized warning from clang
Kristian Høgsberg
hoegsberg at gmail.com
Wed Sep 11 10:44:22 PDT 2013
On Wed, Aug 28, 2013 at 05:43:34PM -0500, Aaron Faanes wrote:
> This warning is unnecessary, since the pointer in question is only used
> for pointer arithmetic, but setting it explicitly to NULL doesn't hurt.
This is more than just a warning, reading an uninitialized value is
undefined and not guaranteed to give the same result for multiple
reads (the wl_container_of macro reads it twice).
Applied, thanks.
Kristian
> ---
> src/wayland-server.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index a1d69e5..d7c58b9 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -501,7 +501,7 @@ wl_resource_get_link(struct wl_resource *resource)
> WL_EXPORT struct wl_resource *
> wl_resource_from_link(struct wl_list *link)
> {
> - struct wl_resource *resource;
> + struct wl_resource *resource = NULL;
>
> return wl_container_of(link, resource, link);
> }
> --
> 1.8.3.1
>
> _______________________________________________
> 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