From 2244bf5716c0362aec8f4881fdca9f8f1457d9b3 Mon Sep 17 00:00:00 2001 From: normal Date: Tue, 2 Jan 2018 21:23:47 +0000 Subject: thread_pthread.c: use container_of It's easier to read this macro from ccan than open-coding pointer arithmetic. thread_pthread.c (ubf_wakeup_all_threads): use container_of git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 469c9748b2..e1b20be58a 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1226,8 +1226,7 @@ ubf_wakeup_all_threads(void) if (!ubf_threads_empty()) { native_mutex_lock(&ubf_list_lock); list_for_each(&ubf_list_head, dat, ubf_list) { - th = (rb_thread_t *)( - ((char *)dat) - offsetof(rb_thread_t, native_thread_data)); + th = container_of(dat, rb_thread_t, native_thread_data); ubf_wakeup_thread(th); } native_mutex_unlock(&ubf_list_lock); -- cgit v1.2.3