aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/queue.c')
-rw-r--r--src/queue.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/queue.c b/src/queue.c
index 2ab9939..0ebfd49 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -25,6 +25,7 @@ typedef struct QueueHeadStruct QueueHead;
#define getHead(X) (((QueueNode*)(pChar(X)-offsetof(QueueNode, buf)))->head)
#define getSize(X) (sizeof(QueueNode) + (getHead(X)->size))
+/************ constructure / destructure ******************/
pvoid ctl_queue_initX(ppvoid q, uint size){
QueueHead* head = (QueueHead*)ctl_malloc(sizeof(QueueHead));
head->size = size;
@@ -50,18 +51,21 @@ pvoid ctl_queue_freeX(ppvoid q){
return NULL;
}
+/********************* get??? method **********************/
uint ctl_queue_getEntrySizeX(ppcvoid q){
return getHead(*q)->size;
}
-
-pcvoid ctl_queue_getX(ppcvoid q){
+
+pvoid ctl_queue_getX(ppvoid q){
return *q;
}
+
+/******************* queue's methods **********************/
int ctl_queue_isEmptyX(ppcvoid q){
return (getHead(*q)->first == NULL ? 1 : 0);
}
-pcvoid ctl_queue_addX(ppvoid q, pcvoid data){
+pvoid ctl_queue_addX(ppvoid q, pcvoid data){
QueueHead* head = getHead(*q);
if(head->first == NULL){
head->first = (QueueNode*)ctl_malloc(getSize(*q));