aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/config.h.post
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-02 00:21:56 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-02 00:21:56 +0000
commitb505ecce3956d6be1ab0554257d7ce9ead09ff89 (patch)
treef3fb355188472d17ff0826c27fc73d4b50e523ba /config.h.post
parentba6b743ba088a1ee889f6315c05711d3e4505d61 (diff)
downloadmandoc-b505ecce3956d6be1ab0554257d7ce9ead09ff89.tar.gz
mandoc-b505ecce3956d6be1ab0554257d7ce9ead09ff89.tar.zst
mandoc-b505ecce3956d6be1ab0554257d7ce9ead09ff89.zip
This is a little gross: Linux and Apple need lots some cajoling to work
with byte-swapping. Tested on Mac. Any Linux machines somebody can test on? Anybody? While here, note the correct byte-size in mandocdb(8) and also note field widths and endianness. The btree is now endian-neutral.
Diffstat (limited to 'config.h.post')
-rw-r--r--config.h.post10
1 files changed, 10 insertions, 0 deletions
diff --git a/config.h.post b/config.h.post
index 3cdf9a78..62ce4ea6 100644
--- a/config.h.post
+++ b/config.h.post
@@ -15,6 +15,16 @@
# endif
#endif
+#if defined(__APPLE__)
+# define htobe32(x) OSSwapHostToBigInt32(x)
+# define betoh32(x) OSSwapBigToHostInt32(x)
+# define htobe64(x) OSSwapHostToBigInt64(x)
+# define betoh64(x) OSSwapBigToHostInt64(x)
+#elif defined(__linux__)
+# define betoh32(x) be32toh(x)
+# define betoh64(x) be64toh(x)
+#endif
+
#ifndef HAVE_STRLCAT
extern size_t strlcat(char *, const char *, size_t);
#endif