diff options
author | Emil Velikov <[email protected]> | 2017-02-15 15:36:00 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-02-16 15:27:20 +0000 |
commit | 40bf7ba023a3a9b2027aa0b51adb6a591e472d59 (patch) | |
tree | d94c7c30556830645a50b70a4e727e09da116bd5 /src/egl/main | |
parent | b8ae2fe3e6e0568754506e88fbb4c51feb8b2de3 (diff) |
egl: _eglFilterArray's filter is always non-null
Drop the extra handling and assert() if things change in the future.
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/eglarray.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/egl/main/eglarray.c b/src/egl/main/eglarray.c index d2f39af49a6..ba6cb3e6a4e 100644 --- a/src/egl/main/eglarray.c +++ b/src/egl/main/eglarray.c @@ -26,6 +26,7 @@ **************************************************************************/ +#include <assert.h> #include <stdlib.h> #include <string.h> @@ -157,25 +158,15 @@ _eglFilterArray(_EGLArray *array, void **data, EGLint size, if (!array) return 0; - if (filter) { - for (i = 0; i < array->Size; i++) { - if (filter(array->Elements[i], filter_data)) { - if (data && count < size) - data[count] = array->Elements[i]; - count++; - } - if (data && count >= size) - break; - } - } - else { - if (data) { - count = (size < array->Size) ? size : array->Size; - memcpy(data, array->Elements, count * sizeof(array->Elements[0])); - } - else { - count = array->Size; + assert(filter); + for (i = 0; i < array->Size; i++) { + if (filter(array->Elements[i], filter_data)) { + if (data && count < size) + data[count] = array->Elements[i]; + count++; } + if (data && count >= size) + break; } return count; |