Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. inline void *__list_find(struct list_head *head, size_t offset, char (*equality_func)(void*, void*), void *context)
  2. {
  3. struct list_head *pos, *n;
  4. list_for_each_safe(pos, n, head)
  5. {
  6. void *obj = (void*)((unsigned long)pos-offset);
  7. if(equality_func(obj, context))
  8. return obj;
  9. }
  10. return NULL;
  11. }
  12.  
  13. #define list_find(type, member, head, equality_func, context) \
  14. __list_find(head, offsetof(type, member), equality_func, context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement