i965: simplify intel_image_format_lookup()
authorEmil Velikov <emil.velikov@collabora.com>
Mon, 31 Jul 2017 18:45:27 +0000 (19:45 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 2 Aug 2017 19:42:21 +0000 (20:42 +0100)
Drop the local variable and return directly.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/intel_screen.c

index e9974a35d9805eb1ce5fd0f1a69efe358a0e69a5..8ec3e03963f37160b46a198a35d3d585a8712676 100644 (file)
@@ -349,16 +349,12 @@ intel_image_warn_if_unaligned(__DRIimage *image, const char *func)
 static const struct intel_image_format *
 intel_image_format_lookup(int fourcc)
 {
-   const struct intel_image_format *f = NULL;
-
    for (unsigned i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
-      if (intel_image_formats[i].fourcc == fourcc) {
-        f = &intel_image_formats[i];
-        break;
-      }
+      if (intel_image_formats[i].fourcc == fourcc)
+         return &intel_image_formats[i];
    }
 
-   return f;
+   return NULL;
 }
 
 static boolean intel_lookup_fourcc(int dri_format, int *fourcc)