From 84b9644ee3761183172f3fbbed95f649fdfea5e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 25 Jun 2021 19:30:24 +0200 Subject: [PATCH] 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[]`. --- spa/include/spa/utils/defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/include/spa/utils/defs.h b/spa/include/spa/utils/defs.h index aafb5c056..d87038577 100644 --- a/spa/include/spa/utils/defs.h +++ b/spa/include/spa/utils/defs.h @@ -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;