summaryrefslogtreecommitdiffstats
path: root/link.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-12-16 17:11:12 +0100
committerLouis Burda <quent.burda@gmail.com>2021-12-20 15:31:31 +0100
commit3eea7a245a7ed49127a222628543f9509a6ff2b6 (patch)
tree345a923819b73bc88b551af5f708476239b6b7d9 /link.c
parent15a8fe2cf2b16af8739a7ec2b64b5c5f184161b8 (diff)
downloadtmus-3eea7a245a7ed49127a222628543f9509a6ff2b6.tar.gz
tmus-3eea7a245a7ed49127a222628543f9509a6ff2b6.zip
Switched most buffers to wide chars, added general ref class, now clear mpd errors, added track and command completion
Diffstat (limited to 'link.c')
-rw-r--r--link.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/link.c b/link.c
deleted file mode 100644
index 26372e7..0000000
--- a/link.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "link.h"
-#include "util.h"
-
-int
-list_len(struct link *head)
-{
- struct link *iter;
- int len;
-
- ASSERT(head != NULL);
-
- len = 0;
- for (iter = head->next; iter; iter = iter->next)
- len += 1;
-
- return len;
-}
-
-int
-list_ffind(struct link *head, struct link *link)
-{
- struct link *iter;
-
- ASSERT(head != NULL);
-
- for (iter = head->next; iter && iter != link; iter = iter->next);
-
- return (iter == link);
-}
-
-struct link *
-link_back(struct link *link)
-{
- ASSERT(link != NULL);
-
- for (; link->next; link = link->next);
-
- return link;
-}
-
-void
-link_prepend(struct link *cur, struct link *link)
-{
- ASSERT(cur != NULL && link != NULL);
-
- link->prev = cur->prev;
- link->next = cur;
-
- if (link->prev)
- link->prev->next = link;
- if (link->next)
- link->next->prev = link;
-}
-
-void
-link_append(struct link *cur, struct link *link)
-{
- ASSERT(cur != NULL && link != NULL);
-
- link->prev = cur;
- link->next = cur->next;
-
- if (link->prev)
- link->prev->next = link;
- if (link->next)
- link->next->prev = link;
-}
-
-void
-link_pop(struct link *link)
-{
- ASSERT(link != NULL);
-
- if (link->prev)
- link->prev->next = link->next;
- if (link->next)
- link->next->prev = link->prev;
-}
-
-struct link *
-link_iter(struct link *link, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- if (!link) return NULL;
- link = link->next;
- }
-
- return link;
-}
-
-void
-link_push_back(struct link *cur, struct link *link)
-{
- struct link *back;
-
- back = link_back(cur);
- link_append(back, link);
-}