summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-01-08 11:14:35 +0000
committerEric Engestrom <[email protected]>2019-06-22 15:17:42 +0000
commit64c7c05b71a7f15890fe75f6d8f5ac1a860808ec (patch)
tree5b16b7d46375090272f0ca11d8a6b0715668eabf
parent262787b9bc3d4281f10a1c0247fc2a2b63b234b2 (diff)
egl: move bad_param check further up
This way other functions added in these entrypoints don't need to check anything. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
-rw-r--r--src/egl/main/eglapi.c8
-rw-r--r--src/egl/main/eglconfig.c6
2 files changed, 8 insertions, 6 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index ed160e65b20..93c1da9aac0 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -721,6 +721,10 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+
+ if (!num_config)
+ RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
+
ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config);
RETURN_EGL_EVAL(disp, ret);
@@ -738,6 +742,10 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs,
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+
+ if (!num_config)
+ RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
+
ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs,
config_size, num_config);
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 72cd73d5179..0a95e8ee05d 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -737,9 +737,6 @@ _eglFilterConfigArray(_EGLArray *array, EGLConfig *configs,
_EGLConfig **configList;
EGLint i, count;
- if (!num_configs)
- return _eglError(EGL_BAD_PARAMETER, "eglChooseConfig");
-
/* get the number of matched configs */
count = _eglFilterArray(array, NULL, 0,
(_EGLArrayForEach) match, priv_data);
@@ -851,9 +848,6 @@ EGLBoolean
_eglGetConfigs(_EGLDriver *drv, _EGLDisplay *disp, EGLConfig *configs,
EGLint config_size, EGLint *num_config)
{
- if (!num_config)
- return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs");
-
*num_config = _eglFlattenArray(disp->Configs, (void *) configs,
sizeof(configs[0]), config_size, _eglFlattenConfig);