diff options
author | Chad Versace <[email protected]> | 2016-09-27 13:27:18 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2016-10-04 14:11:29 -0700 |
commit | 02e4f1cb43c548a4ff27fb8d7bc9255bb4488c1e (patch) | |
tree | bd6ddbfb499149762d1c7518b82f09fc458f3304 /src/egl/main/eglsync.c | |
parent | 3e0d575a6d727c4334b783c443a5e1980dca43b4 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/egl/main/eglsync.c')
-rw-r--r-- | src/egl/main/eglsync.c | 14 |
1 files 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; } |