aboutsummaryrefslogtreecommitdiff
path: root/src/lib/q.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-06 15:51:48 -0800
committerChristian Cunningham <cc@localhost>2022-01-06 15:51:48 -0800
commita61201b8047ebe278cfb281723a4bf6c82556472 (patch)
treef3b2d5b4a9e537fa8f370b00d0c4d4b637223303 /src/lib/q.c
parenta826a645a67c2be3c7acb097c436c810da728ed7 (diff)
Scheduling
Diffstat (limited to 'src/lib/q.c')
-rw-r--r--src/lib/q.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/q.c b/src/lib/q.c
index ebae2b9..2ade143 100644
--- a/src/lib/q.c
+++ b/src/lib/q.c
@@ -38,3 +38,17 @@ void pop_q(struct Q_base* qb)
free(t->data);
free(t);
}
+
+unsigned long length_q(struct Q_base* qb)
+{
+ unsigned long length = 0;
+ if(qb->next == 0)
+ return length;
+ length++;
+ struct Q* q = qb->next;
+ while (q != qb->last) {
+ length++;
+ q = q->next;
+ }
+ return length;
+}