[PATCH weston v2 2/8] shared/image: Silence maybe-uninitialized warning
Giulio Camuffo
giuliocamuffo at gmail.com
Mon Aug 8 10:23:20 UTC 2016
Hi,
Reviewed-by: Giulio Camuffo <giuliocamuffo at gmail.com>
2016-07-10 11:00 GMT+02:00 Quentin Glidic <sardemff7+wayland at sardemff7.net>:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>
> shared/image-loader.c: In function 'load_image':
> shared/image-loader.c:434:12: warning: 'image' may be used uninitialized
> in this function [-Wmaybe-uninitialized]
> } else if (!image) {
> ^
>
> Warning produced by GCC 5.3 and 6.1, with -Og.
>
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
> shared/image-loader.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/shared/image-loader.c b/shared/image-loader.c
> index f477dfd..86b0ead 100644
> --- a/shared/image-loader.c
> +++ b/shared/image-loader.c
> @@ -395,7 +395,7 @@ static const struct image_loader loaders[] = {
> pixman_image_t *
> load_image(const char *filename)
> {
> - pixman_image_t *image;
> + pixman_image_t *image = NULL;
> unsigned char header[4];
> FILE *fp;
> unsigned int i;
> @@ -430,7 +430,6 @@ load_image(const char *filename)
> fprintf(stderr, "%s: unrecognized file header "
> "0x%02x 0x%02x 0x%02x 0x%02x\n",
> filename, header[0], header[1], header[2], header[3]);
> - image = NULL;
> } else if (!image) {
> /* load probably printed something, but just in case */
> fprintf(stderr, "%s: error reading image\n", filename);
> --
> 2.9.0
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list