/** \defgroup pw_array Array * * \brief An array object * * The array is a dynamically resizable data structure that can * hold items of the same size.
*/
/** * \addtogroup pw_array * \{
*/ struct pw_array { void *data; /**< pointer to array data */
size_t size; /**< length of array in bytes */
size_t alloc; /**< number of allocated memory in \a data */
size_t extend; /**< number of bytes to extend with */
};
/** Get the number of items of type \a t in array */ #define pw_array_get_len(a,t) pw_array_get_len_s(a,sizeof(t)) /** Get the item with index \a idx and type \a t from array */ #define pw_array_get_unchecked(a,idx,t) pw_array_get_unchecked_s(a,idx,sizeof(t),t) /** Check if an item with index \a idx and type \a t exist in array */ #define pw_array_check_index(a,idx,t) pw_array_check_index_s(a,idx,sizeof(t))
/** Add \a ref size bytes to \a arr. A pointer to memory that can
* hold at least \a size bytes is returned */ staticinlinevoid *pw_array_add(struct pw_array *arr, size_t size)
{ void *p;
if (pw_array_ensure_size(arr, size) < 0) return NULL;
p = SPA_PTROFF(arr->data, arr->size, void);
arr->size += size;
return p;
}
/** Add \a ref size bytes to \a arr. When there is not enough memory to
* hold \a size bytes, NULL is returned */ staticinlinevoid *pw_array_add_fixed(struct pw_array *arr, size_t size)
{ void *p;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.