void InsertNode(ListNode *pHead, AppInfo *pAppInfo)
{
ListNode* pNode = NULL;
ListNode* pNext = NULL;
ListNode* pTemp = NULL;
ListNode* pNewNode = NULL;
if ((NULL == pHead) || (NULL == pAppInfo))
{
return;
}
pNode = pHead;
while (pNode->pNext != NULL)
{
pNext = pNode->pNext;
if (pAppInfo->hot >= pNext->data->hot)
{
break;
}
pNode = pNode->pNext;
}
while (pNode->pNext != NULL)
{
pNext = pNode->pNext;
if (pAppInfo->hot == pNext->data->hot && pAppInfo->appNo < pNext->data->appNo)
{
pNode = pNode->pNext;
}
else
{
break;
}
}
pNewNode = (ListNode *)malloc(sizeof(ListNode));
if (NULL == pNewNode)
{
return;
}
pNewNode->data = pAppInfo;
//insert
pTemp = pNode->pNext;
pNode->pNext = pNewNode;
pNewNode->pNext = pTemp;
return;
}
{
ListNode* pNode = NULL;
ListNode* pNext = NULL;
ListNode* pTemp = NULL;
ListNode* pNewNode = NULL;
if ((NULL == pHead) || (NULL == pAppInfo))
{
return;
}
pNode = pHead;
while (pNode->pNext != NULL)
{
pNext = pNode->pNext;
if (pAppInfo->hot >= pNext->data->hot)
{
break;
}
pNode = pNode->pNext;
}
while (pNode->pNext != NULL)
{
pNext = pNode->pNext;
if (pAppInfo->hot == pNext->data->hot && pAppInfo->appNo < pNext->data->appNo)
{
pNode = pNode->pNext;
}
else
{
break;
}
}
pNewNode = (ListNode *)malloc(sizeof(ListNode));
if (NULL == pNewNode)
{
return;
}
pNewNode->data = pAppInfo;
//insert
pTemp = pNode->pNext;
pNode->pNext = pNewNode;
pNewNode->pNext = pTemp;
return;
}