summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--2048.c6
-rw-r--r--freecell.c6
-rw-r--r--snake.c6
3 files changed, 15 insertions, 3 deletions
diff --git a/2048.c b/2048.c
index b042ee0..2eb323e 100644
--- a/2048.c
+++ b/2048.c
@@ -22,11 +22,15 @@
 
 typedef unsigned uint;
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#include <features.h>
+#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 36)
+#else
 static uint arc4random_uniform(uint upper_bound) {
 	return rand() % upper_bound;
 }
 #endif
+#endif
 
 static uint score;
 static uint grid[4][4];
diff --git a/freecell.c b/freecell.c
index c543bda..53b9712 100644
--- a/freecell.c
+++ b/freecell.c
@@ -30,11 +30,15 @@
 
 typedef unsigned uint;
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#include <features.h>
+#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 36)
+#else
 static uint arc4random_uniform(uint upper_bound) {
 	return rand() % upper_bound;
 }
 #endif
+#endif
 typedef unsigned char byte;
 
 typedef byte Card;
diff --git a/snake.c b/snake.c
index 06ec230..5e1c103 100644
--- a/snake.c
+++ b/snake.c
@@ -27,11 +27,15 @@
 
 typedef unsigned uint;
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && (!defined(__GLIBC__) || !__GLIBC_PREREQ(2, 36))
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#include <features.h>
+#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 36)
+#else
 static uint arc4random_uniform(uint upper_bound) {
 	return rand() % upper_bound;
 }
 #endif
+#endif
 typedef unsigned char byte;
 
 enum {