add uc_tailq_link() and use it in uc_tailq_remove()
This commit is contained in:
@@ -85,13 +85,20 @@ static UC_INLINE void uc_tailq_insert_head(struct TailQ *head, struct TailQ *ent
|
||||
uc_tailq_insert(entry, head, head->next);
|
||||
}
|
||||
|
||||
/** Link the first and second entry together,
|
||||
*/
|
||||
static UC_INLINE void uc_tailq_link(struct TailQ *first, struct TailQ *second)
|
||||
{
|
||||
first->next = second;
|
||||
second->prev = first;
|
||||
}
|
||||
|
||||
/** Remove the entry from the list it is part of.
|
||||
* (It *must* already be part of a list.
|
||||
*/
|
||||
static UC_INLINE void uc_tailq_remove(struct TailQ *entry)
|
||||
{
|
||||
entry->prev->next = entry->next;
|
||||
entry->next->prev = entry->prev;
|
||||
uc_tailq_link(entry->prev, entry->next);
|
||||
|
||||
//help catch illegal use:
|
||||
entry->next = (void*)0x101;
|
||||
|
||||
Reference in New Issue
Block a user