From e79d4932ea413c277425ff92c456741e0730c3d6 Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Wed, 21 Mar 2018 12:21:37 +0100 Subject: More robust preprocessor switches Replace #ifdef with #if defined() and #elif with #elif defined() as it should only test if it is defined or not. --- components/uptime.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'components/uptime.c') diff --git a/components/uptime.c b/components/uptime.c index c5e28ee..8a04b92 100644 --- a/components/uptime.c +++ b/components/uptime.c @@ -1,8 +1,8 @@ /* See LICENSE file for copyright and license details. */ #include -#ifdef __linux__ +#if defined(__linux__) #include -#elif __OpenBSD__ +#elif defined(__OpenBSD__) #include #include #endif @@ -15,12 +15,12 @@ uptime(void) int h; int m; int uptime = 0; -#ifdef __linux__ +#if defined(__linux__) struct sysinfo info; sysinfo(&info); uptime = info.uptime; -#elif __OpenBSD__ +#elif defined(__OpenBSD__) int mib[2]; size_t size; time_t now; -- cgit v1.2.3