mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
dynarray: Add PA_DYNARRAY_FOREACH
The PA_DYNARRAY_FOREACH macro requires that pa_dynarray_get() returns NULL if the index is out of bounds.
This commit is contained in:
parent
7d3879c07f
commit
360cb6550e
3 changed files with 8 additions and 4 deletions
|
|
@ -72,7 +72,9 @@ void pa_dynarray_append(pa_dynarray *array, void *p) {
|
|||
|
||||
void *pa_dynarray_get(pa_dynarray *array, unsigned i) {
|
||||
pa_assert(array);
|
||||
pa_assert(i < array->n_entries);
|
||||
|
||||
if (i >= array->n_entries)
|
||||
return NULL;
|
||||
|
||||
return array->data[i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue