summaryrefslogtreecommitdiffstats
path: root/src/egl/main
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-06-20 15:40:28 +0100
committerEmil Velikov <[email protected]>2017-06-26 12:41:00 +0100
commitc58af5cbb295760687b23428f8ac240459e5cf56 (patch)
tree0bf1c53aedde3010b4254c12531c6249e85d13ca /src/egl/main
parentd42b09580a5270e8906dad4b923f320d1de18167 (diff)
egl: fold _eglError() + return EGL_FALSE
The function _eglError() already explicitly returns EGL_FALSE, explicitly to simplify the callers. Make use of it. While EGL_FALSE is numerically identical to false, NULL, EGL_NO_FOO, storage is not the same so we cannot use it for "everything". Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/eglcontext.c6
-rw-r--r--src/egl/main/egldisplay.c10
-rw-r--r--src/egl/main/eglsurface.c74
3 files changed, 30 insertions, 60 deletions
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 05cc523c8d1..df8b45c7bd6 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -489,10 +489,8 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
const EGLenum api = eglQueryAPI();
EGLint err;
- if (api == EGL_NONE) {
- _eglError(EGL_BAD_MATCH, "eglCreateContext(no client API)");
- return EGL_FALSE;
- }
+ if (api == EGL_NONE)
+ return _eglError(EGL_BAD_MATCH, "eglCreateContext(no client API)");
_eglInitResource(&ctx->Resource, sizeof(*ctx), dpy);
ctx->ClientAPI = api;
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 6eeaa35eb63..7aaab3c2c94 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -495,12 +495,10 @@ _eglParseX11DisplayAttribList(_EGLDisplay *display, const EGLint *attrib_list)
/* EGL_EXT_platform_x11 recognizes exactly one attribute,
* EGL_PLATFORM_X11_SCREEN_EXT, which is optional.
*/
- if (attrib == EGL_PLATFORM_X11_SCREEN_EXT) {
- display->Options.Platform = (void *)(uintptr_t)value;
- } else {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
- return EGL_FALSE;
- }
+ if (attrib != EGL_PLATFORM_X11_SCREEN_EXT)
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
+
+ display->Options.Platform = (void *)(uintptr_t)value;
}
return EGL_TRUE;
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 8094912ba12..f6e41f10d78 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -286,11 +286,9 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
return EGL_FALSE;
}
- if ((conf->SurfaceType & type) == 0) {
+ if ((conf->SurfaceType & type) == 0)
/* The config can't be used to create a surface of this type */
- _eglError(EGL_BAD_MATCH, func);
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_MATCH, func);
_eglInitResource(&surf->Resource, sizeof(*surf), dpy);
surf->Type = type;
@@ -397,36 +395,32 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
*value = surface->VGColorspace;
break;
case EGL_GL_COLORSPACE_KHR:
- if (!dpy->Extensions.KHR_gl_colorspace) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
- }
+ if (!dpy->Extensions.KHR_gl_colorspace)
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
+
*value = surface->GLColorspace;
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
*value = surface->PostSubBufferSupportedNV;
break;
case EGL_BUFFER_AGE_EXT:
- if (!dpy->Extensions.EXT_buffer_age) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
- }
+ if (!dpy->Extensions.EXT_buffer_age)
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
+
_EGLContext *ctx = _eglGetCurrentContext();
EGLint result = drv->API.QueryBufferAge(drv, dpy, surface);
/* error happened */
if (result < 0)
return EGL_FALSE;
if (_eglGetContextHandle(ctx) == EGL_NO_CONTEXT ||
- ctx->DrawSurface != surface) {
- _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
- return EGL_FALSE;
- }
+ ctx->DrawSurface != surface)
+ return _eglError(EGL_BAD_SURFACE, "eglQuerySurface");
+
*value = result;
surface->BufferAgeRead = EGL_TRUE;
break;
default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
- return EGL_FALSE;
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
}
return EGL_TRUE;
@@ -513,25 +507,17 @@ _eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
if (dpy->Extensions.NOK_texture_from_pixmap)
texture_type |= EGL_PIXMAP_BIT;
- if (!(surface->Type & texture_type)) {
- _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (!(surface->Type & texture_type))
+ return _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
- if (surface->TextureFormat == EGL_NO_TEXTURE) {
- _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (surface->TextureFormat == EGL_NO_TEXTURE)
+ return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- if (surface->TextureTarget == EGL_NO_TEXTURE) {
- _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (surface->TextureTarget == EGL_NO_TEXTURE)
+ return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- if (buffer != EGL_BACK_BUFFER) {
- _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
- return EGL_FALSE;
- }
+ if (buffer != EGL_BACK_BUFFER)
+ return _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
surface->BoundToTexture = EGL_TRUE;
@@ -549,10 +535,7 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLint texture_type = EGL_PBUFFER_BIT;
if (surf == EGL_NO_SURFACE)
- {
- _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
if (!surf->BoundToTexture)
{
@@ -561,25 +544,16 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
}
if (surf->TextureFormat == EGL_NO_TEXTURE)
- {
- _eglError(EGL_BAD_MATCH, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_MATCH, "eglReleaseTexImage");
if (buffer != EGL_BACK_BUFFER)
- {
- _eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
if (dpy->Extensions.NOK_texture_from_pixmap)
texture_type |= EGL_PIXMAP_BIT;
if (!(surf->Type & texture_type))
- {
- _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
- return EGL_FALSE;
- }
+ return _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
surf->BoundToTexture = EGL_FALSE;