back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/server/card_queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/card_queue.c')
-rw-r--r--server/card_queue.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/card_queue.c b/server/card_queue.c
index 194ea0c..c5d59a8 100644
--- a/server/card_queue.c
+++ b/server/card_queue.c
@@ -45,6 +45,8 @@ const char* pop_card_queue(struct card_queue *cq)
cq->first = cq->first->next;
card = tmp->str;
free(tmp);
+ if(!cq->first)
+ cq->last = NULL;
return card;
}
@@ -59,3 +61,16 @@ int find_out_card_quantity_in_cq(const struct card_queue *cq)
}
return counter;
}
+
+void clear_queue(struct card_queue *cq)
+{
+ struct card_queue_item *tmp;
+
+ while(cq->first) {
+ tmp = cq->first;
+ cq->first = cq->first->next;
+ free(tmp);
+ }
+ cq->first = NULL;
+ cq->last = NULL;
+}