aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_common.h
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-04 16:47:17 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-04 16:47:17 +0900
commit292cefa2a12a78ae54fb56a3961452f439cb744f (patch)
tree14bcb29874ecab1301c624b375e0df088c03614f /src/include/gnunet_common.h
parentcbe225ddce5627c59902cfdb9524dead675d19d0 (diff)
downloadgnunet-292cefa2a12a78ae54fb56a3961452f439cb744f.tar.gz
gnunet-292cefa2a12a78ae54fb56a3961452f439cb744f.zip
BUILD: Attempt to disentable platform.h, gnunet_common.h and gnunet_private_config.h insanity
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r--src/include/gnunet_common.h38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index d4654a75c..375ff1adc 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -40,29 +40,35 @@
40#ifndef GNUNET_COMMON_H 40#ifndef GNUNET_COMMON_H
41#define GNUNET_COMMON_H 41#define GNUNET_COMMON_H
42 42
43#include "gnunet_platform.h" 43#include "gnunet_config.h"
44
44#include <stdlib.h> 45#include <stdlib.h>
45#if HAVE_SYS_SOCKET_H
46#include <sys/socket.h> 46#include <sys/socket.h>
47#endif
48#if HAVE_NETINET_IN_H
49#include <netinet/in.h> 47#include <netinet/in.h>
50#endif
51#ifdef HAVE_STDINT_H
52#include <stdint.h> 48#include <stdint.h>
53#endif
54#ifdef HAVE_STDARG_H
55#include <stdarg.h> 49#include <stdarg.h>
56#endif
57#ifdef HAVE_SYS_TYPES_H
58#include <sys/types.h> 50#include <sys/types.h>
59#endif
60#ifdef HAVE_SYS_SOCKET_H
61#include <sys/socket.h>
62#endif
63 51
52#if defined(__FreeBSD__)
53
54#include <sys/endian.h>
55#define bswap_32(x) bswap32(x)
56#define bswap_64(x) bswap64(x)
57
58#elif defined(__OpenBSD__)
59
60#define bswap_32(x) swap32(x)
61#define bswap_64(x) swap64(x)
62
63#elif defined(__NetBSD__)
64
65#include <machine/bswap.h>
66#if defined(__BSWAP_RENAME) && !defined(__bswap_32)
67#define bswap_32(x) bswap32(x)
68#define bswap_64(x) bswap64(x)
69#endif
64 70
65#ifdef HAVE_BYTESWAP_H 71#elif defined(__linux__) || defined(GNU)
66#include <byteswap.h> 72#include <byteswap.h>
67#endif 73#endif
68 74
@@ -156,7 +162,7 @@ enum GNUNET_GenericReturnValue
156 */ 162 */
157 163
158#if __BYTE_ORDER == __LITTLE_ENDIAN 164#if __BYTE_ORDER == __LITTLE_ENDIAN
159#ifdef HAVE_BYTESWAP_H 165#if defined(bswap_16) || defined(bswap_32) || defined(bswap_64)
160#define BYTE_SWAP_16(x) bswap_16 (x) 166#define BYTE_SWAP_16(x) bswap_16 (x)
161#define BYTE_SWAP_32(x) bswap_32 (x) 167#define BYTE_SWAP_32(x) bswap_32 (x)
162#define BYTE_SWAP_64(x) bswap_64 (x) 168#define BYTE_SWAP_64(x) bswap_64 (x)