src/pipewire/map.h
static inline int pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)
{
	size_t size = pw_map_get_size(map);
	union pw_map_item *item;

	if (id > size)
		return -ENOSPC;
	else if (id == size) {
		item = (union pw_map_item *) pw_array_add(&map->items, sizeof(union pw_map_item));
		if (item == NULL)
			return -errno;
	}
	else {
		item = pw_map_get_item(map, id);
	}
	item->data = data;
	return 0;
}
/** Insert data in the map at an index
 * \param map the map to inser into
 * \param id the index to insert at
 * \param data the data to insert
 * \return 0 on success, -ENOSPC value when the index is invalid or a < 0
 *	errno value.
 * \memberof pw_map
 */
Insert data in the map at an index
\param map the map to inser into
\param id the index to insert at
\param data the data to insert
\return 0 on success, -ENOSPC value when the index is invalid or a < 0
errno value.
Insert data in the map at an index \ param map the map to inser into \ param id the index to insert at \ param data the data to insert \ return 0 on success - ENOSPC value when the index is invalid or a < 0 errno value .
static inline int pw_map_insert_at(struct pw_map *map, uint32_t id, void *data)
{
	size_t size = pw_map_get_size(map);
	union pw_map_item *item;
	if (id > size)
		return -ENOSPC;
	else if (id == size) {
		item = (union pw_map_item *) pw_array_add(&map->items, sizeof(union pw_map_item));
		if (item == NULL)
			return -errno;
	}
	else {
		item = pw_map_get_item(map, id);
	}
	item->data = data;
	return 0;
}
static inline int pw_map_insert_at ( struct pw_map * map , uint32_t id , void * data ) { size_t size = pw_map_get_size ( map ) ; union pw_map_item * item ; if ( id > size ) return - ENOSPC ; else if ( id == size ) { item = ( union pw_map_item * ) pw_array_add ( & map -> items , sizeof ( union pw_map_item ) ) ; if ( item == NULL ) return - errno ; } else { item = pw_map_get_item ( map , id ) ; } item -> data = data ; return 0 ; }
Insert data in the map at an index
 \param map the map to inser into
 \param id the index to insert at
 \param data the data to insert
 \return 0 on success, -ENOSPC value when the index is invalid or a < 0
      errno value.
Insert data in the map at an index \ param map the map to inser into \ param id the index to insert at \ param data the data to insert \ return 0 on success - ENOSPC value when the index is invalid or a < 0 errno value .