summaryrefslogtreecommitdiffstats
path: root/ref.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-12-20 16:25:43 +0100
committerLouis Burda <quent.burda@gmail.com>2021-12-20 16:25:43 +0100
commitf07580d31d1148c4a1811c36b09ca0ad50d9576b (patch)
tree05a8fbb44af81f3b5937df80c5af3305ec3ed3c9 /ref.c
parentfaee8e9c6db45c6adacfc5113d55927f92e8bf29 (diff)
downloadtmus-f07580d31d1148c4a1811c36b09ca0ad50d9576b.tar.gz
tmus-f07580d31d1148c4a1811c36b09ca0ad50d9576b.zip
Restructured repository and added automatic make dependency generation
Diffstat (limited to 'ref.c')
-rw-r--r--ref.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/ref.c b/ref.c
deleted file mode 100644
index c961dd7..0000000
--- a/ref.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "ref.h"
-#include "util.h"
-
-struct ref *
-ref_init(void *data)
-{
- struct ref *ref;
-
- ref = malloc(sizeof(struct ref));
- ASSERT(ref != NULL);
- ref->link = LINK_EMPTY;
- ref->data = data;
- return ref;
-}
-
-void
-ref_free(struct ref *ref)
-{
- free(ref);
-}
-
-void
-refs_free(struct link *head)
-{
- struct link *cur;
-
- while (head->next) {
- cur = link_pop(head->next);
- ref_free(UPCAST(cur, struct ref));
- }
-}
-
-static struct link *
-refs_ffind(struct link *head, void *data)
-{
- struct link *iter;
-
- for (iter = head->next; iter; iter = iter->next) {
- if (UPCAST(iter, struct ref)->data == data)
- return iter;
- }
-
- return NULL;
-}
-
-int
-refs_incl(struct link *head, void *data)
-{
- struct link *ref;
-
- ref = refs_ffind(head, data);
- return ref != NULL;
-}
-
-void
-refs_rm(struct link *head, void *data)
-{
- struct link *ref;
- struct ref *dataref;
-
- ref = refs_ffind(head, data);
- if (!ref) return;
-
- dataref = UPCAST(ref, struct ref);
- link_pop(ref);
- free(dataref);
-}
-