有点看不懂。
大大啊 2010-09-16 05:20:05 void elist_init_root(elist_t *root)
{
root->next = root->prev = root;
}
/* Add new element at the tail of the list. */
void elist_add_tail (elist_t *root,elist_t *newp)
{
root->prev->next = newp;
newp->next = root;
newp->prev = root->prev;
root->prev = newp;
}
/* Remove element from list. not use interface */
void elist_del_elem (elist_t *elem)
{
elem->next->prev = elem->prev;
elem->prev->next = elem->next;
}
/* get element at the head of the list and remove
the element from the list. if no element return NULL.
*/
elist_t* elist_remove_head(elist_t *root)
{
elist_t *next = 0;
if (root != root->next)
{
next = root->next;
elist_del_elem(root->next);
}
return next;
}