add uc_tailq_link() and use it in uc_tailq_remove()

This commit is contained in:
Nils O. Selåsdal
2013-11-28 20:01:25 +01:00
parent 6156fcbbb5
commit 80d73629bf
+9 -2
View File
@@ -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;