diff options
author | Christian Cunningham <cc@localhost> | 2022-03-24 09:38:08 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-03-24 09:38:08 -0700 |
commit | 93bf62580a68533dc8252b9a2a055c02f34ecb67 (patch) | |
tree | 1b1ca92ebbe107a998136a1442c0dba5be885e13 /src/lib/queue.c | |
parent | 3e64dda5d5c350cc325650133f7e64967f1efe84 (diff) |
Modularized
Diffstat (limited to 'src/lib/queue.c')
-rw-r--r-- | src/lib/queue.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/lib/queue.c b/src/lib/queue.c deleted file mode 100644 index 1fc35f6..0000000 --- a/src/lib/queue.c +++ /dev/null @@ -1,55 +0,0 @@ -#include <lib/queue.h> - -void push_to_queue(struct Entry* e, struct Queue* q) -{ - q->end.next->next = e; - q->end.next = e; - e->next = &q->end; -} - -void prepend_to_queue(struct Entry* e, struct Queue* q) -{ - e->next = q->start.next; - q->start.next = e; - if (e->next->entry_type == END_ENTRY) - q->end.next = e; -} - -struct Entry* pop_from_queue(struct Queue* q) -{ - if (q->start.next->entry_type == END_ENTRY) - return 0; - struct Entry* e = q->start.next; - q->start.next = e->next; - if (e->next->entry_type == END_ENTRY) - q->end.next = &q->start; - return e; -} - -struct Entry* remove_next_from_queue(struct Entry* e) -{ - struct Entry* prev = e; - struct Entry* remove = e->next; - struct Entry* next = remove->next; - if (remove->entry_type != VALUE_ENTRY) - return 0; - prev->next = next; - if (next->entry_type == END_ENTRY) - next->next = prev; - return remove; -} - -struct Entry* find_value(void* value, struct Queue* q) -{ - struct Entry* prev; - struct Entry* entry; - prev = &q->start; - entry = prev->next; - while (entry->entry_type != END_ENTRY) { - if (entry->value == value) - return prev; - prev = entry; - entry = prev->next; - } - return 0; -} |