| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef SL_LIST_H__
- # define SL_LIST_H__
- # define SL_LIST_BUFLEN 8
- struct sl_list_item {
- void *data[SL_LIST_BUFLEN];
- struct sl_list_item *next;
- };
- typedef struct {
- unsigned int count;
- struct sl_list_item *first;
- } sl_list;
- /**
- * Allocate a new list and return it
- * result should be unallocated with sllist_destroy()
- **/
- sl_list *sllist_create();
- /**
- * Free all ressources allocated by sllist_create
- **/
- void sllist_destroy(sl_list *list);
- /**
- * Get the numbers of items contained in sl_list
- **/
- unsigned int sllist_count(const sl_list * const list);
- /**
- * Add an item at the end of the list
- **/
- sl_list *sllist_pushback(sl_list *list, void *item);
- /**
- * Remove the last item of the list and return it
- **/
- void *sllist_popback(sl_list *list);
- /**
- * Get the item at position %pos
- **/
- void *sllist_at(const sl_list * const list, unsigned int pos);
- /**
- * Remove the item at position %pos, and return it
- * TODO
- **/
- void *sllist_removeat(sl_list *list, unsigned int pos);
- /**
- * Remove all elements
- **/
- sl_list *sllist_clear(sl_list *list);
- #endif /* SL_LIST_H__ */
|