list.h 774 B

12345678910111213141516171819
  1. #ifndef _TOTP_LIST_H_
  2. #define _TOTP_LIST_H_
  3. #include <stdlib.h>
  4. #include <inttypes.h>
  5. typedef struct ListNode {
  6. void* data;
  7. struct ListNode *next;
  8. } ListNode;
  9. ListNode *list_init_head(void* data);
  10. ListNode *list_add(ListNode *head, void* data); /* adds element with specified data to the end of the list and returns new head node. */
  11. ListNode *list_find(ListNode *head, void* data); /* returns pointer of element with specified data in list. */
  12. ListNode *list_element_at(ListNode *head, uint16_t index); /* returns pointer of element with specified index in list. */
  13. ListNode *list_remove(ListNode *head, ListNode *ep); /* removes element from the list and returns new head node. */
  14. void list_free(ListNode *head); /* deletes all elements of the list. */
  15. #endif