Mesa (master): i965: simplify intel_image_format_lookup()

Emil Velikov evelikov at kemper.freedesktop.org
Wed Aug 2 19:47:19 UTC 2017


Module: Mesa
Branch: master
Commit: df8321370204434f2a7ca7cf29be973e060781ed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=df8321370204434f2a7ca7cf29be973e060781ed

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Mon Jul 31 19:45:27 2017 +0100

i965: simplify intel_image_format_lookup()

Drop the local variable and return directly.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/intel_screen.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index e9974a35d9..8ec3e03963 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -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)




More information about the mesa-commit mailing list