X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Flist.h;h=6384728bc054d551fccd811cec27f43dc41d61da;hp=7ccb76aeee760f0686155c0de34e568fc49fc50b;hb=b46b23cb9949c585ddf8ccb691458c8c7c60c7ad;hpb=7a50dcf71c2134c4755ceee9cdaa865a07be27ad diff --git a/urcu/list.h b/urcu/list.h index 7ccb76a..6384728 100644 --- a/urcu/list.h +++ b/urcu/list.h @@ -65,14 +65,28 @@ list_add_tail (list_t *newp, list_t *head) } +/* Remove element from list. */ +static inline void +__list_del (list_t *prev, list_t *next) +{ + next->prev = prev; + prev->next = next; +} + /* Remove element from list. */ static inline void list_del (list_t *elem) { - elem->next->prev = elem->prev; - elem->prev->next = elem->next; + __list_del (elem->prev, elem->next); } +/* delete from list, add to another list as head */ +static inline void +list_move (list_t *elem, list_t *head) +{ + __list_del (elem->prev, elem->next); + list_add (elem, head); +} /* Join two lists. */ static inline void