clist.h   clist.h 
skipping to change at line 28 skipping to change at line 28
struct HXlist_head list; struct HXlist_head list;
struct HXlist_head *next, *prev; struct HXlist_head *next, *prev;
}; };
unsigned int items; unsigned int items;
}; };
#define HXCLIST_HEAD_INIT(name) {{{&(name).list, &(name).list}}, 0} #define HXCLIST_HEAD_INIT(name) {{{&(name).list, &(name).list}}, 0}
#define HXCLIST_HEAD(name) \ #define HXCLIST_HEAD(name) \
struct HXclist_head name = HXCLIST_HEAD_INIT(name) struct HXclist_head name = HXCLIST_HEAD_INIT(name)
static inline void HXclist_init_head(struct HXclist_head *head) static inline void HXclist_init(struct HXclist_head *head)
{
head->list.next = head->list.prev = &head->list;
head->items = 0;
}
static __attribute__((deprecated)) inline void
HXclist_init_head(struct HXclist_head *head)
{ {
head->list.next = head->list.prev = &head->list; head->list.next = head->list.prev = &head->list;
head->items = 0; head->items = 0;
} }
static inline void HXclist_del(struct HXclist_head *head,
struct HXlist_head *node)
{
--head->items;
HXlist_del(node);
}
static inline void HXclist_unshift(struct HXclist_head *head, static inline void HXclist_unshift(struct HXclist_head *head,
struct HXlist_head *nu) struct HXlist_head *nu)
{ {
++head->items; ++head->items;
__HXlist_add(nu, &head->list, head->list.next); __HXlist_add(nu, &head->list, head->list.next);
} }
static inline void HXclist_push(struct HXclist_head *head, static inline void HXclist_push(struct HXclist_head *head,
struct HXlist_head *nu) struct HXlist_head *nu)
{ {
skipping to change at line 61 skipping to change at line 75
if ((const void *)head == head->list.next) if ((const void *)head == head->list.next)
return NULL; return NULL;
p = head->list.prev; p = head->list.prev;
HXlist_del(p); HXlist_del(p);
--head->items; --head->items;
return p; return p;
} }
#define HXclist_pop(head, type, member) ({ \ #define HXclist_pop(head, type, member) ({ \
struct HXlist_head *x = __HXclist_pop(head); \ struct HXlist_head *x = __HXclist_pop(head); \
container_of(x, type, member); \ HXlist_entry(x, type, member); \
}) })
static inline struct HXlist_head *__HXclist_shift(struct HXclist_head *head ) static inline struct HXlist_head *__HXclist_shift(struct HXclist_head *head )
{ {
struct HXlist_head *p; struct HXlist_head *p;
if ((const void *)head == head->list.next) if ((const void *)head == head->list.next)
return NULL; return NULL;
p = head->list.next; p = head->list.next;
HXlist_del(p); HXlist_del(p);
--head->items; --head->items;
return p; return p;
} }
#define HXclist_shift(head, type, member) ({ \ #define HXclist_shift(head, type, member) ({ \
struct HXlist_head *x = __HXclist_shift(head); \ struct HXlist_head *x = __HXclist_shift(head); \
container_of(x, type, member); \ HXlist_entry(x, type, member); \
}) })
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* _LIBHX_CLIST_H */ #endif /* _LIBHX_CLIST_H */
 End of changes. 4 change blocks. 
3 lines changed or deleted 17 lines changed or added


 list.h   list.h 
skipping to change at line 20 skipping to change at line 20
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef container_of #ifndef container_of
# define container_of(ptr, type, member) ({ \ # define container_of(ptr, type, member) ({ \
const typeof(((type *)0)->member) *__mptr = (ptr); \ const typeof(((type *)0)->member) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); \ (type *)((char *)__mptr - offsetof(type, member)); \
}) })
#endif #endif
#define HXlist_entry(ptr, type, member) container_of((ptr), type, member)
struct HXlist_head { struct HXlist_head {
struct HXlist_head *next, *prev; struct HXlist_head *next, *prev;
}; };
#define HXLIST_HEAD_INIT(name) {&(name), &(name)} #define HXLIST_HEAD_INIT(name) {&(name), &(name)}
#define HXLIST_HEAD(name) \ #define HXLIST_HEAD(name) \
struct HXlist_head name = HXLIST_HEAD_INIT(name) struct HXlist_head name = HXLIST_HEAD_INIT(name)
static inline void HXlist_init_head(struct HXlist_head *list) static inline void HXlist_init(struct HXlist_head *list)
{
list->next = list->prev = list;
}
static __attribute__((deprecated)) inline void
HXlist_init_head(struct HXlist_head *list)
{ {
list->next = list->prev = list; list->next = list->prev = list;
} }
static inline void __HXlist_add(struct HXlist_head *nu, static inline void __HXlist_add(struct HXlist_head *nu,
struct HXlist_head *prev, struct HXlist_head *next) struct HXlist_head *prev, struct HXlist_head *next)
{ {
nu->next = next; nu->next = next;
nu->prev = prev; nu->prev = prev;
next->prev = nu; next->prev = nu;
skipping to change at line 67 skipping to change at line 74
entry->prev->next = entry->next; entry->prev->next = entry->next;
entry->next->prev = entry->prev; entry->next->prev = entry->prev;
entry->next = NULL; entry->next = NULL;
entry->prev = NULL; entry->prev = NULL;
} }
#define HXlist_for_each(pos, head) \ #define HXlist_for_each(pos, head) \
for ((pos) = (head)->next; (pos) != (void *)(head); \ for ((pos) = (head)->next; (pos) != (void *)(head); \
(pos) = (pos)->next) (pos) = (pos)->next)
#define HXlist_for_each_safe(pos, n, head) \
for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (void *)(head
); \
(pos) = (n), (n) = (pos)->next)
#define HXlist_for_each_entry(pos, head, member) \ #define HXlist_for_each_entry(pos, head, member) \
for ((pos) = container_of((head)->next, typeof(*(pos)), member); \ for ((pos) = HXlist_entry((head)->next, typeof(*(pos)), member); \
&(pos)->member != (void *)(head); \ &(pos)->member != (void *)(head); \
(pos) = container_of((pos)->member.next, typeof(*(pos)), member (pos) = HXlist_entry((pos)->member.next, typeof(*(pos)), member
)) ))
#define HXlist_for_each_entry_safe(pos, n, head, member) \
for ((pos) = HXlist_entry((head)->next, typeof(*(pos)), member), \
(n) = HXlist_entry((pos)->member.next, typeof(*(pos)), member);
\
&(pos)->member != (void *)(head); \
(pos) = (n), (n) = HXlist_entry((n)->member.next, typeof(*(n)),
\
member))
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* _LIBHX_LIST_H */ #endif /* _LIBHX_LIST_H */
 End of changes. 5 change blocks. 
4 lines changed or deleted 25 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/