1 Star 1 Fork 0

hotmocha / spider

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
queue.c 714 Bytes
一键复制 编辑 原始数据 按行查看 历史
hotmocha 提交于 2015-04-02 22:29 . spider init
#include "queue.h"
Queue* InitQueue()
{
ListHead *q = NewListHead();
return q;
}
void FreeQueue(Queue *q)
{
if (q)
FreeListHead(q);
}
int IsEmpty(Queue *q)
{
if (!q)
return TRUE;
if (q->NodeCnt == 0)
return TRUE;
else
return FALSE;
}
int GetSize(Queue *q)
{
if (!q)
return 0;
return q->NodeCnt;
}
int EnQueue(Queue *q, void *data)
{
int ret = 0;
if (!q)
return QUEUE_ERR_ARGNULL;
ret = InsertDataBeTheFirst(q, data);
return ret;
}
void* DeQueue(Queue *q)
{
void *dataTemp = NULL;
if (q && q->NodeCnt > 0) {
dataTemp = q->last->data;
DeleteListNode(q, q->last);
}
return dataTemp;
}
void ClearQueue(Queue *q)
{
if (q) {
while(q->NodeCnt > 0) {
DeQueue(q);
}
}
}
1
https://gitee.com/hotmocha/spider.git
git@gitee.com:hotmocha/spider.git
hotmocha
spider
spider
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891