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>
**************************************************************************/
**************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
- 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;