src/pipewire/map.h
static inline uint32_t pw_map_insert_new(struct pw_map *map, void *data)
{
	union pw_map_item *start, *item;
	uint32_t id;

	if (map->free_list != SPA_ID_INVALID) {
		start = (union pw_map_item *) map->items.data;
		item = &start[map->free_list >> 1];
		map->free_list = item->next;
	} else {
		item = (union pw_map_item *) pw_array_add(&map->items, sizeof(union pw_map_item));
		if (item == NULL)
			return SPA_ID_INVALID;
		start = (union pw_map_item *) map->items.data;
	}
	item->data = data;
	id = (item - start);
	return id;
}
/** Insert data in the map
 * \param map the map to insert into
 * \param data the item to add
 * \return the id where the item was inserted or SPA_ID_INVALID when the
 *	item can not be inserted.
 * \memberof pw_map
 */
Insert data in the map
\param map the map to insert into
\param data the item to add
\return the id where the item was inserted or SPA_ID_INVALID when the
item can not be inserted.
Insert data in the map \ param map the map to insert into \ param data the item to add \ return the id where the item was inserted or SPA_ID_INVALID when the item can not be inserted .
static inline uint32_t pw_map_insert_new(struct pw_map *map, void *data)
{
	union pw_map_item *start, *item;
	uint32_t id;
	if (map->free_list != SPA_ID_INVALID) {
		start = (union pw_map_item *) map->items.data;
		item = &start[map->free_list >> 1];
		map->free_list = item->next;
	} else {
		item = (union pw_map_item *) pw_array_add(&map->items, sizeof(union pw_map_item));
		if (item == NULL)
			return SPA_ID_INVALID;
		start = (union pw_map_item *) map->items.data;
	}
	item->data = data;
	id = (item - start);
	return id;
}
static inline uint32_t pw_map_insert_new ( struct pw_map * map , void * data ) { union pw_map_item * start , * item ; uint32_t id ; if ( map -> free_list != SPA_ID_INVALID ) { start = ( union pw_map_item * ) map -> items . data ; item = & start [ map -> free_list >> 1 ] ; map -> free_list = item -> next ; } else { item = ( union pw_map_item * ) pw_array_add ( & map -> items , sizeof ( union pw_map_item ) ) ; if ( item == NULL ) return SPA_ID_INVALID ; start = ( union pw_map_item * ) map -> items . data ; } item -> data = data ; id = ( item - start ) ; return id ; }
Insert data in the map
 \param map the map to insert into
 \param data the item to add
 \return the id where the item was inserted or SPA_ID_INVALID when the
      item can not be inserted.
Insert data in the map \ param map the map to insert into \ param data the item to add \ return the id where the item was inserted or SPA_ID_INVALID when the item can not be inserted .