HOT_TAB_INFO_LIST hot_creat_tab_list(U8 num)
{
HOT_TAB_INFO_LIST head = NULL, prev = NULL, current = NULL;
U8 index = 0;
if(0 == num)
{
return NULL;
}
head = prev = current = (HOT_TAB_INFO_LIST)hot_mem_malloc(sizeof(HOT_TAB_INFO_NODE));
head->prior = NULL;
index++;
while(index != num)
{
prev = current;
current = (HOT_TAB_INFO_LIST)hot_mem_malloc(sizeof(HOT_TAB_INFO_NODE));
if(NULL == current)
{
return NULL;
}
prev->next = current;
current->prior = prev;
index++;
}
head->prior = current;
current->next = head;
return head;
}
//删除链表
while(current != NULL)
{
/*逐一释放链表中所有的空间*/
if(current->next != current)
{
node = current;
prev = current->next;
current->prior->next = current->next;
current->next->prior = current->prior;
current = prev;
if(node->namePtr != NULL)
{
hot_mem_free((void *)node->namePtr);
node->namePtr = NULL;
}
if(node->urlPtr != NULL)
{
hot_mem_free((void *)node->urlPtr);
node->urlPtr = NULL;
}
if(node != NULL)
{
hot_mem_free((void *)node);
node = NULL;
}
}
else
{
if(current->namePtr != NULL)
{
hot_mem_free((void *)current->namePtr);
current->namePtr = NULL;
}
if(current->urlPtr != NULL)
{
hot_mem_free((void *)current->urlPtr);
current->urlPtr = NULL;
}
if(current != NULL)
{
hot_mem_free((void *)current);
current = NULL;
}
}
}