Commit fa3be74a authored by Jacob Vosmaer's avatar Jacob Vosmaer

Use bool return type for list predicates

parent f72b6993
......@@ -53,8 +53,8 @@ uint8_t l_last(struct list *l) {
}
void l_flush(struct list *l) { l->len = 0; }
uint8_t l_empty(struct list *l) { return l->len == 0; }
uint8_t l_contains(struct list *l, uint8_t x) { return l_index(l, x) < l->sup; }
bool l_empty(struct list *l) { return l->len == 0; }
bool l_contains(struct list *l, uint8_t x) { return l_index(l, x) < l->sup; }
uint8_t l_index(struct list *l, uint8_t x) {
for (uint8_t i = 0; i < l->len; i++) {
......
......@@ -2,6 +2,7 @@
#define LIST_H
#include <stdint.h>
#include <stdbool.h>
struct list {
uint8_t len;
......@@ -23,8 +24,8 @@ void l_delete(struct list *l, uint8_t x);
uint8_t l_first(struct list *l);
uint8_t l_last(struct list *l);
void l_flush(struct list *l);
uint8_t l_empty(struct list *l);
uint8_t l_contains(struct list *l, uint8_t x);
bool l_empty(struct list *l);
bool l_contains(struct list *l, uint8_t x);
uint8_t l_index(struct list *l, uint8_t x);
uint8_t l_popr(struct list *l);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment