mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
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:
parent
d6a569620c
commit
84b9644ee3
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue