diff --git a/include/ucore/tailq.h b/include/ucore/tailq.h index 08a2d47..ab4f0e2 100644 --- a/include/ucore/tailq.h +++ b/include/ucore/tailq.h @@ -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;