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);
|
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.
|
/** Remove the entry from the list it is part of.
|
||||||
* (It *must* already be part of a list.
|
* (It *must* already be part of a list.
|
||||||
*/
|
*/
|
||||||
static UC_INLINE void uc_tailq_remove(struct TailQ *entry)
|
static UC_INLINE void uc_tailq_remove(struct TailQ *entry)
|
||||||
{
|
{
|
||||||
entry->prev->next = entry->next;
|
uc_tailq_link(entry->prev, entry->next);
|
||||||
entry->next->prev = entry->prev;
|
|
||||||
|
|
||||||
//help catch illegal use:
|
//help catch illegal use:
|
||||||
entry->next = (void*)0x101;
|
entry->next = (void*)0x101;
|
||||||
|
|||||||
Reference in New Issue
Block a user