mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
array: add and use pw_array_consume
This commit is contained in:
parent
720b7b5c6a
commit
649448fb5f
2 changed files with 6 additions and 7 deletions
|
|
@ -145,14 +145,8 @@ static int clear_subjects(struct metadata *this, uint32_t subject)
|
|||
static void clear_items(struct metadata *this)
|
||||
{
|
||||
struct item *item;
|
||||
|
||||
while (true) {
|
||||
item = pw_array_first(&this->metadata);
|
||||
if (!pw_array_check(&this->metadata, item))
|
||||
break;
|
||||
|
||||
pw_array_consume(item, &this->metadata)
|
||||
clear_subjects(this, item->subject);
|
||||
}
|
||||
pw_array_reset(&this->metadata);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@ struct pw_array {
|
|||
pw_array_check(array, pos); \
|
||||
(pos)++)
|
||||
|
||||
#define pw_array_consume(pos, array) \
|
||||
for (pos = (__typeof__(pos)) pw_array_first(array); \
|
||||
pw_array_check(array, pos); \
|
||||
pos = (__typeof__(pos)) pw_array_first(array))
|
||||
|
||||
#define pw_array_remove(a,p) \
|
||||
({ \
|
||||
(a)->size -= sizeof(*(p)); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue