use __linux__ def for detecting Linux

see https://sourceforge.net/p/predef/wiki/OperatingSystems/

This is a prerequisite for switching to Meson:
related to https://github.com/i3/i3status/issues/459
This commit is contained in:
Michael Stapelberg 2021-10-31 18:49:45 +01:00
parent d6f0850353
commit 52f6db0788
2 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ void print_load(yajl_gen json_gen, char *buffer, const char *format, const char
char *outwalk = buffer;
/* Get load */
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) || defined(__DragonFly__)
double loadavg[3];
const char *selected_format = format;
bool colorful_output = false;

View File

@ -12,12 +12,12 @@
#define BINARY_BASE 1024UL
#if defined(linux)
#if defined(__linux__)
static const char *const iec_symbols[] = {"B", "KiB", "MiB", "GiB", "TiB"};
#define MAX_EXPONENT ((sizeof iec_symbols / sizeof *iec_symbols) - 1)
#endif
#if defined(linux)
#if defined(__linux__)
/*
* Prints the given amount of bytes in a human readable manner.
*
@ -42,7 +42,7 @@ static int print_percentage(char *outwalk, float percent) {
}
#endif
#if defined(linux)
#if defined(__linux__)
/*
* Convert a string to its absolute representation based on the total
* memory of `mem_total`.
@ -89,7 +89,7 @@ static unsigned long memory_absolute(const char *mem_amount, const unsigned long
void print_memory(yajl_gen json_gen, char *buffer, const char *format, const char *format_degraded, const char *threshold_degraded, const char *threshold_critical, const char *memory_used_method, const char *unit, const int decimals) {
char *outwalk = buffer;
#if defined(linux)
#if defined(__linux__)
const char *selected_format = format;
const char *output_color = NULL;