From 02e4f1cb43c548a4ff27fb8d7bc9255bb4488c1e Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 27 Sep 2016 13:27:18 -0700 Subject: [PATCH] egl: Cleanup control flow in _eglParseSyncAttribList When the function encountered an error, it effectively returned immediately. However, it did so indirectly by breaking out of a loop. Replace the loop breakout with a explicit 'return'. Do the same for _eglParseSyncAttribList64 too. Reviewed-by: Emil Velikov --- src/egl/main/eglsync.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c index f3250319dcc..6f779921caf 100644 --- a/src/egl/main/eglsync.c +++ b/src/egl/main/eglsync.c @@ -41,7 +41,7 @@ static EGLint _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) { - EGLint i, err = EGL_SUCCESS; + EGLint i; if (!attrib_list) return EGL_SUCCESS; @@ -49,6 +49,7 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) for (i = 0; attrib_list[i] != EGL_NONE; i++) { EGLint attr = attrib_list[i++]; EGLint val = attrib_list[i]; + EGLint err = EGL_SUCCESS; switch (attr) { default: @@ -59,18 +60,18 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list) if (err != EGL_SUCCESS) { _eglLog(_EGL_DEBUG, "bad sync attribute 0x%04x", attr); - break; + return err; } } - return err; + return EGL_SUCCESS; } static EGLint _eglParseSyncAttribList64(_EGLSync *sync, const EGLAttrib *attrib_list) { - EGLint i, err = EGL_SUCCESS; + EGLint i; if (!attrib_list) return EGL_SUCCESS; @@ -78,6 +79,7 @@ _eglParseSyncAttribList64(_EGLSync *sync, const EGLAttrib *attrib_list) for (i = 0; attrib_list[i] != EGL_NONE; i++) { EGLAttrib attr = attrib_list[i++]; EGLAttrib val = attrib_list[i]; + EGLint err = EGL_SUCCESS; switch (attr) { case EGL_CL_EVENT_HANDLE_KHR: @@ -94,11 +96,11 @@ _eglParseSyncAttribList64(_EGLSync *sync, const EGLAttrib *attrib_list) if (err != EGL_SUCCESS) { _eglLog(_EGL_DEBUG, "bad sync attribute 0x%" PRIxPTR, attr); - break; + return err; } } - return err; + return EGL_SUCCESS; } -- 2.30.2