@@ -28,6 +28,7 @@ extern "C" {
2828/* *INDENT-ON* */
2929
3030#include <stdint.h>
31+ #include <stddef.h>
3132#include <qb/qbdefs.h>
3233
3334/**
@@ -112,13 +113,13 @@ static inline void qb_list_del(struct qb_list_head *_remove)
112113 * @param old: the element to be replaced
113114 * @param new: the new element to insert
114115 */
115- static inline void qb_list_replace (struct qb_list_head * old ,
116- struct qb_list_head * new )
116+ static inline void qb_list_replace (struct qb_list_head * old_one ,
117+ struct qb_list_head * new_one )
117118{
118- new -> next = old -> next ;
119- new -> next -> prev = new ;
120- new -> prev = old -> prev ;
121- new -> prev -> next = new ;
119+ new_one -> next = old_one -> next ;
120+ new_one -> next -> prev = new_one ;
121+ new_one -> prev = old_one -> prev ;
122+ new_one -> prev -> next = new_one ;
122123}
123124
124125/**
@@ -193,8 +194,8 @@ static inline void qb_list_splice_tail(struct qb_list_head *list,
193194 * @param type: the type of the struct this is embedded in.
194195 * @param member: the name of the list_struct within the struct.
195196 */
196- #define qb_list_entry (ptr ,type ,member )\
197- ((type *)((char *)( ptr)-(char*)(&(( type *)0)-> member)))
197+ #define qb_list_entry (ptr ,type ,member ) ({ \
198+ ((type *)((char*) ptr - offsetof( type, member))); } )
198199
199200/**
200201 * Get the first element from a list
0 commit comments