diff options
author | Emil Velikov <[email protected]> | 2019-05-16 18:01:33 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-06-05 13:35:21 -0400 |
commit | 72b9aa973b010a6be95b5f955c658113016a36f5 (patch) | |
tree | d35e23545e7e95294c4da3f99c156ce4989aeb5a /src/egl/main/eglapi.c | |
parent | 4ff02b3edddbb4024c6dc349973f60f5ba4886d6 (diff) |
egl: flesh out a _eglNumAttribs() helper
Reviewed-by: Mathias Fröhlich <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r-- | src/egl/main/eglapi.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 61a3220705d..fb26c8a0888 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -340,22 +340,16 @@ _eglConvertIntsToAttribs(const EGLint *int_list, EGLAttrib **out_attrib_list) static EGLint * _eglConvertAttribsToInt(const EGLAttrib *attr_list) { + size_t size = _eglNumAttribs(attr_list); EGLint *int_attribs = NULL; /* Convert attributes from EGLAttrib[] to EGLint[] */ - if (attr_list) { - int i, size = 0; - - while (attr_list[size] != EGL_NONE) - size += 2; - - size += 1; /* add space for EGL_NONE */ - + if (size) { int_attribs = calloc(size, sizeof(int_attribs[0])); if (!int_attribs) return NULL; - for (i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) int_attribs[i] = attr_list[i]; } return int_attribs; |