pod: don't iterate 0 sized children

That will just create and endless loop and because the child has no
size, there is not really anything to iterate.
This commit is contained in:
Wim Taymans 2024-01-16 16:34:37 +01:00
parent a00981ec20
commit b029a2ce05

View file

@ -79,7 +79,7 @@ static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_
#define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter) \
for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_array_body), void); \
spa_ptrinside(body, _size, iter, (body)->child.size, NULL); \
(body)->child.size > 0 && spa_ptrinside(body, _size, iter, (body)->child.size, NULL); \
(iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
#define SPA_POD_ARRAY_FOREACH(obj, iter) \
@ -87,7 +87,7 @@ static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_
#define SPA_POD_CHOICE_BODY_FOREACH(body, _size, iter) \
for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_choice_body), void); \
spa_ptrinside(body, _size, iter, (body)->child.size, NULL); \
(body)->child.size > 0 && spa_ptrinside(body, _size, iter, (body)->child.size, NULL); \
(iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
#define SPA_POD_CHOICE_FOREACH(obj, iter) \