updated list lib

This commit is contained in:
2025-07-08 20:05:01 -06:00
parent d1f38e397e
commit c002c78b9a
7 changed files with 579 additions and 97 deletions
+40
View File
@@ -0,0 +1,40 @@
#include <list.h>
#include <stddef.h>
int ListCount(LIST *list) {
return (int) list->size;
}
void *ListFirst(LIST *list) {
list->current = list->head;
return list->current->data;
}
void *ListLast(LIST *list) {
list->current = list->tail;
return list->current->data;
}
void *ListNext(LIST *list) {
if (list->current->next != NULL) {
list->current = list->current->next;
return list->current->data;
}
return NULL;
}
void *ListPrev(LIST *list) {
if (list->current->next != NULL) {
list->current = list->current->previous;
return list->current->data;
}
return NULL;
}
void *ListCurr(LIST *list) {
if (list->current != NULL) {
return list->current->data;
}
return NULL;
}