From ab3964db4e75e34f6f9347406c5fd2bced04f2dd Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 13 Oct 2015 14:50:20 +0200 Subject: libbb: introduce kernel-style BUILD_BUG_ON() Signed-off-by: Denys Vlasenko --- runit/runsv.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'runit') diff --git a/runit/runsv.c b/runit/runsv.c index 94d2860..6cf5bcc 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -49,16 +49,11 @@ static void gettimeofday_ns(struct timespec *ts) #else static void gettimeofday_ns(struct timespec *ts) { - if (sizeof(struct timeval) == sizeof(struct timespec) - && sizeof(((struct timeval*)ts)->tv_usec) == sizeof(ts->tv_nsec) - ) { - /* Cheat */ - gettimeofday((void*)ts, NULL); - ts->tv_nsec *= 1000; - } else { - extern void BUG_need_to_implement_gettimeofday_ns(void); - BUG_need_to_implement_gettimeofday_ns(); - } + BUILD_BUG_ON(sizeof(struct timeval) != sizeof(struct timespec)); + BUILD_BUG_ON(sizeof(((struct timeval*)ts)->tv_usec) != sizeof(ts->tv_nsec)); + /* Cheat */ + gettimeofday((void*)ts, NULL); + ts->tv_nsec *= 1000; } #endif -- cgit v1.1