Browse Source

[Listener] Fix byte order macros for OpenBSD >= 5.6

master
Matteo Cypriani 2 years ago
parent
commit
78f13f2c0b
1 changed files with 15 additions and 4 deletions
  1. 15
    4
      owlps-listener/owlps-listener.h

+ 15
- 4
owlps-listener/owlps-listener.h View File

@@ -62,11 +62,22 @@
62 62
 # else // __BYTE_ORDER
63 63
 #  error "This program does not handle strange architectures."
64 64
 # endif // __BYTE_ORDER
65
+/* Non-glibc systems (mostly BSDs at this point).
66
+ * - OpenBSD 5.6 and higher defines le*toh in <endian.h>. Former versions
67
+ *   defined letoh* in <sys/types.h>.
68
+ * - NetBSD, FreeBSD and DragonFly define le*toh in <sys/endian.h>.
69
+ */
65 70
 #else // __GLIBC__
66
-# include <sys/endian.h>
67
-# ifdef OpenBSD
68
-#  define le32toh letoh32
69
-#  define le16toh letoh16
71
+# if defined(OpenBSD)
72
+#  if OpenBSD < 201411 // OpenBSD < 5.6
73
+#   include <sys/types.h>
74
+#   define le32toh letoh32
75
+#   define le16toh letoh16
76
+#  else // OpenBSD < 5.6
77
+#   include <endian.h>
78
+#  endif // OpenBSD < 5.6
79
+# else // OpenBSD
80
+#  include <sys/endian.h>
70 81
 # endif // OpenBSD
71 82
 #endif // __GLIBC__
72 83
 

Loading…
Cancel
Save