list_t*l_create(size_ttype,intblocksize);/** Allocates new list_t aligned to size <type> (e.g. "sizeof(int)"), and first block with <blocksize> (use l_create_d(size_t) to use default blocksize) **/
list_t*l_create_from(void*from,intitems,size_ttype,intbs);/** Allocates new list_t and copies elements from <from> into it **/
voidl_destroy(list_t*t);/** Frees all memory alocated to <t> and then frees <t> **/
voidl_add(list_t*t,constvoid*o);/** Adds new element at end of array with copy of data at <o>, then updates ->length pointer **/
int l_add(list_t*t,constvoid*o);/** Adds new element at end of array with copy of data at <o>, then updates ->length pointer and returns index of new element **/
void*l_get(constlist_t*t,intindex);/** Returns pointer to element at <index> **/
voidl_nullify(list_t*t,intindex);/** Writes over element at <index> with 0s (bytes) **/
voidl_copy(constlist_t*src,intso,list_t*de,into,intlen);/** Copies <len> elements from <src> (offset by <so>) to <de> (offset by <o>) **/
@ -74,6 +75,10 @@ void l_swap(list_t *t, int index1, int index2); /** Swap elements at <index
voidl_sort(list_t*t,_l_sort_algalg,_l_comparatorcomp);/** Sorts <t> with algorithm <alg> using comparator <comp> **/
list_t*l_clone(constlist_t*t);/** Creates new list from <t> **/
list_t*l_clone_if(constlist_t*t,_l_predicatef);/** Creates new list from <t> with all elements that satisfy <f> **/
intl_count(constlist_t*t,_l_predicatef);/** Count all elements that satisfy <f>, or all if <f> is NULL **/
void*l_push(list_t*t,constvoid*o);/** Adds new element at end of <t>, updates ->length, and returns pointer to element **/
intl_pop(list_t*t,void*pop_into);/** Removes last element after copying it into <pop_into> (if not NULL), then updates ->length and returns new length. returns -1 if ->length is 0 **/
void*l_pop_n(list_t*t);/** Copies last element into newly malloc'd memory and calls l_pop, returns pointer to new memory. returns NULL if ->length is 0 **/
l_iteratorli_create(list_t*list);/** Creates iterator from <list> and initialises at index 0 **/
intli_next(l_iterator*it);/** Updates current element and increments pointer in <it> and returns non-zero if index is in bounds **/