aboutsummaryrefslogtreecommitdiff
path: root/src/lib/q.c
diff options
context:
space:
mode:
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;
+}