dynarray: make UBSan happy

This commit is contained in:
Andrei Alexeyev 2024-08-21 23:02:57 +02:00
parent 47c8f5bee3
commit 7acdad7531
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -84,6 +84,10 @@ void _dynarray_set_elements(dynarray_size_t sizeof_element, DynamicArray *darr,
}
void _dynarray_filter(dynarray_size_t sizeof_element, DynamicArray *darr, dynarray_filter_predicate_t predicate, void *userdata) {
if(UNLIKELY(!darr->data)) {
return;
}
char *p = darr->data;
char *end = p + sizeof_element * darr->num_elements;
dynarray_size_t shift = 0;