aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcathook <cat.hook31894@gmail.com>2013-12-17 00:12:12 +0800
committercathook <cat.hook31894@gmail.com>2013-12-17 00:12:12 +0800
commit54d2304f9e8a2d027e1a6d278beecfafde3ad537 (patch)
treedd69c145b900b7a9a32a6123ce5dea42ca623f8f
parent13a4e77bdb76a9254fb21b31c62f349ec86028a0 (diff)
downloadctl-54d2304f9e8a2d027e1a6d278beecfafde3ad537.tar.gz
ctl-54d2304f9e8a2d027e1a6d278beecfafde3ad537.tar.zst
ctl-54d2304f9e8a2d027e1a6d278beecfafde3ad537.zip
change return type again
-rw-r--r--inc/queue.h4
-rw-r--r--src/queue.c10
2 files changed, 9 insertions, 5 deletions
diff --git a/inc/queue.h b/inc/queue.h
index 5863f0a..7bb317b 100644
--- a/inc/queue.h
+++ b/inc/queue.h
@@ -8,9 +8,9 @@ pvoid ctl_queue_freeX(ppvoid q);
uint ctl_queue_getEntrySizeX(ppcvoid q);
int ctl_queue_isEmptyX (ppcvoid q);
-pcvoid ctl_queue_getX (ppcvoid q);
+pvoid ctl_queue_getX ( ppvoid q);
-pcvoid ctl_queue_addX(ppvoid q, pcvoid data);
+pvoid ctl_queue_addX(ppvoid q, pcvoid data);
int ctl_queue_delX(ppvoid q);
pvoid ctl_queue_copyX(ppcvoid q, ppvoid q2);
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));