From 3527e270f3b3af4690dcf904b99a5f0fa670dc51 Mon Sep 17 00:00:00 2001 From: Avi Kivity <avi@cloudius-systems.com> Date: Sun, 17 Feb 2013 12:13:56 +0200 Subject: [PATCH] libc: fix ntohl() and friends under mode=release The glibc headers define those as macros, need to undefine before declaring as functions. --- libc/network/htonl.c | 1 + libc/network/htons.c | 1 + libc/network/ntohl.c | 1 + libc/network/ntohs.c | 1 + 4 files changed, 4 insertions(+) diff --git a/libc/network/htonl.c b/libc/network/htonl.c index 6622d16cc..cd8fb6848 100644 --- a/libc/network/htonl.c +++ b/libc/network/htonl.c @@ -1,6 +1,7 @@ #include <netinet/in.h> #include <byteswap.h> +#undef htonl uint32_t htonl(uint32_t n) { union { int i; char c; } u = { 1 }; diff --git a/libc/network/htons.c b/libc/network/htons.c index 03a3a1d59..99a064b0f 100644 --- a/libc/network/htons.c +++ b/libc/network/htons.c @@ -1,6 +1,7 @@ #include <netinet/in.h> #include <byteswap.h> +#undef htons uint16_t htons(uint16_t n) { union { int i; char c; } u = { 1 }; diff --git a/libc/network/ntohl.c b/libc/network/ntohl.c index d6fce4590..0e5b4ea8c 100644 --- a/libc/network/ntohl.c +++ b/libc/network/ntohl.c @@ -1,6 +1,7 @@ #include <netinet/in.h> #include <byteswap.h> +#undef ntohl uint32_t ntohl(uint32_t n) { union { int i; char c; } u = { 1 }; diff --git a/libc/network/ntohs.c b/libc/network/ntohs.c index 745cef425..745fe737a 100644 --- a/libc/network/ntohs.c +++ b/libc/network/ntohs.c @@ -1,6 +1,7 @@ #include <netinet/in.h> #include <byteswap.h> +#undef ntohs uint16_t ntohs(uint16_t n) { union { int i; char c; } u = { 1 }; -- GitLab