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 <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:

committed by
Emil Velikov

parent
b8ae2fe3e6
commit
40bf7ba023
@@ -26,6 +26,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -157,25 +158,15 @@ _eglFilterArray(_EGLArray *array, void **data, EGLint size,
|
|||||||
if (!array)
|
if (!array)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (filter) {
|
assert(filter);
|
||||||
for (i = 0; i < array->Size; i++) {
|
for (i = 0; i < array->Size; i++) {
|
||||||
if (filter(array->Elements[i], filter_data)) {
|
if (filter(array->Elements[i], filter_data)) {
|
||||||
if (data && count < size)
|
if (data && count < size)
|
||||||
data[count] = array->Elements[i];
|
data[count] = array->Elements[i];
|
||||||
count++;
|
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;
|
|
||||||
}
|
}
|
||||||
|
if (data && count >= size)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
Reference in New Issue
Block a user