From e86767c120aa23b842f978e5ad10e3f661ac43ca Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Sat, 2 May 2020 21:12:51 +0800 Subject: [PATCH] add function fc_list_add_before --- src/fc_list.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fc_list.h b/src/fc_list.h index 24cf761..a368c63 100644 --- a/src/fc_list.h +++ b/src/fc_list.h @@ -25,7 +25,6 @@ fc_list_add (struct fc_list_head *_new, struct fc_list_head *head) _new->next->prev = _new; } - static inline void fc_list_add_tail (struct fc_list_head *_new, struct fc_list_head *head) { @@ -37,7 +36,17 @@ fc_list_add_tail (struct fc_list_head *_new, struct fc_list_head *head) } static inline void -fc_list_add_internal(struct fc_list_head *_new, struct fc_list_head *prev, +fc_list_add_before (struct fc_list_head *_new, struct fc_list_head *current) +{ + _new->prev = current->prev; + _new->next = current; + + _new->prev->next = _new; + _new->next->prev = _new; +} + +static inline void +fc_list_add_internal (struct fc_list_head *_new, struct fc_list_head *prev, struct fc_list_head *next) { next->prev = _new;