spa: utils: defs: fix SPA_FOR_EACH_ELEMENT usage example

To iterate over an array of `T`, the iterator must be `(const) T *`,
so that the types are compatible when `T[]` decays into `T *`.

In the example when `struct foo *[]` decays, it becomes `struct foo **`,
which is not compatible with the the type of iterator, `struct foo *`.

Fix that by changing the type of the array to `struct foo[]`.
This commit is contained in:
Barnabás Pőcze 2021-06-25 19:30:24 +02:00 committed by Wim Taymans
parent d6a569620c
commit 84b9644ee3

View file

@ -110,7 +110,7 @@ struct spa_fraction {
/**
* Array iterator macro. Usage:
* ```c
* struct foo *array[16];
* struct foo array[16];
* struct foo *f;
* SPA_FOR_EACH_ELEMENT(array, f) {
* f->bar = baz;