Use, in the rb_entry definition, the container_of macro instead of reinventing
the wheel; compared to using offset_of() as I did in the prev. version, it has
type safety checking.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[email protected]>
---
linux-2.6.9-current-paolo/include/linux/rbtree.h | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
diff -puN include/linux/rbtree.h~use-offsetof-rb_entry include/linux/rbtree.h
--- linux-2.6.9-current/include/linux/rbtree.h~use-offsetof-rb_entry 2004-10-08 11:57:18.523435712 +0200
+++ linux-2.6.9-current-paolo/include/linux/rbtree.h 2004-10-08 13:12:27.602951432 +0200
@@ -113,8 +113,7 @@ struct rb_root
};
#define RB_ROOT (struct rb_root) { NULL, }
-#define rb_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+#define rb_entry(ptr, type, member) container_of(ptr, type, member)
extern void rb_insert_color(struct rb_node *, struct rb_root *);
extern void rb_erase(struct rb_node *, struct rb_root *);
_