From b27ee00bf5e377a4b59b454c68c8617ea9666bc8 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 26 Apr 2012 13:36:02 -0300 Subject: udev: use container_of() macro --- src/udev/collect/collect.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/udev/collect') diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c index 882564a5f5..777542979a 100644 --- a/src/udev/collect/collect.c +++ b/src/udev/collect/collect.c @@ -55,13 +55,9 @@ static int debug; /* This can increase dynamically */ static size_t bufsize = BUFSIZE; -static struct _mate *node_to_mate(struct udev_list_node *node) +static inline struct _mate *node_to_mate(struct udev_list_node *node) { - char *mate; - - mate = (char *)node; - mate -= offsetof(struct _mate, node); - return (struct _mate *)mate; + return container_of(node, struct _mate, node); } static void sig_alrm(int signo) -- cgit v1.2.3-54-g00ecf