diff options
author | Aaron Marcher <me@drkhsh.at> | 2018-03-21 12:21:37 +0100 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-03-21 12:21:37 +0100 |
commit | e79d4932ea413c277425ff92c456741e0730c3d6 (patch) | |
tree | 7f49fbc24b6594ecd22655f47a4523242e326cee /components/uptime.c | |
parent | fc5d23212fdaec8c242db9b25770f290dd287212 (diff) |
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.
Diffstat (limited to 'components/uptime.c')
-rw-r--r-- | components/uptime.c | 8 |
1 files changed, 4 insertions, 4 deletions
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 <stdio.h> -#ifdef __linux__ +#if defined(__linux__) #include <sys/sysinfo.h> -#elif __OpenBSD__ +#elif defined(__OpenBSD__) #include <sys/sysctl.h> #include <sys/time.h> #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; |