summaryrefslogtreecommitdiffstats
path: root/src/list.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-12-27 17:53:13 +0100
committerLouis Burda <quent.burda@gmail.com>2021-12-27 17:53:13 +0100
commit16449e8a72c7d9282647823d1747ae5696619d4f (patch)
treec63a477da9cda19426a76ebf0e3e48b261641835 /src/list.h
parentf07580d31d1148c4a1811c36b09ca0ad50d9576b (diff)
downloadtmus-16449e8a72c7d9282647823d1747ae5696619d4f.tar.gz
tmus-16449e8a72c7d9282647823d1747ae5696619d4f.zip
refactored autoplay and prev/next functionality
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/list.h b/src/list.h
index d74ac9f..b0e174d 100644
--- a/src/list.h
+++ b/src/list.h
@@ -2,10 +2,10 @@
#include <stdlib.h>
-#define OFFSET(type, attr) ((size_t) &((type *)0)->attr)
+#define LINK_OFFSET(type) ((size_t) &((type *)0)->link)
#define UPCAST(ptr, type) ({ \
const typeof( ((type *)0)->link ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - OFFSET(type, link) ); })
+ (type *)( (char *)__mptr - LINK_OFFSET(type) ); })
#define LIST_HEAD ((struct link) { .prev = NULL, .next = NULL })
#define LINK_EMPTY ((struct link) { 0 })
@@ -19,17 +19,17 @@ struct link {
/* list_XXX functions operate on the list head */
+void list_free(struct link *head, void (*free_item)(void *), int offset);
int list_empty(struct link *head);
int list_len(struct link *head);
int list_ffind(struct link *head, struct link *link);
+struct link *list_at(struct link *head, int n);
+void list_push_front(struct link *head, struct link *link);
+void list_push_back(struct link *head, struct link *link);
+struct link *list_pop_front(struct link *head);
-struct link *link_back(struct link *list);
void link_prepend(struct link *list, struct link *link);
void link_append(struct link *list, struct link *link);
+struct link *link_back(struct link *list);
struct link *link_pop(struct link *link);
-
struct link *link_iter(struct link *link, int n);
-
-void list_push_back(struct link *list, struct link *link);
-
-//rstrrrstrssiimmrsrsssts