2022-11-25 07:23:07 +00:00
|
|
|
#include <ordinary/inspect.h>
|
|
|
|
#include <stdlib.h>
|
2022-11-25 07:01:04 +00:00
|
|
|
|
|
|
|
uint8_t ordinary_list_empty(struct ordinary_list *list) {
|
|
|
|
return !list->head;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t ordinary_list_full(struct ordinary_list *list) {
|
|
|
|
return !list->limit || list->count == list->limit;
|
|
|
|
}
|
2022-11-25 07:23:07 +00:00
|
|
|
|
|
|
|
struct ordinary_node *ordinary_list_at(struct ordinary_list *list, uint32_t idx) {
|
|
|
|
struct ordinary_node *node = list->head;
|
|
|
|
|
|
|
|
for(; node; node = node->next) {
|
|
|
|
idx -= 1;
|
|
|
|
|
|
|
|
if(!idx) {
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|