Skip to content

Commit 576a778

Browse files
committed
haiku: add wrappers for ntohl et al.
* These are defined as macros.
1 parent f5b10c4 commit 576a778

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cbits/swap.c

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <netinet/in.h>
2+
3+
static uint32_t my_htonl(uint32_t x) { return htonl(x); }
4+
static uint16_t my_htons(uint16_t x) { return htons(x); }
5+
static uint32_t my_ntohl(uint32_t x) { return ntohl(x); }
6+
static uint32_t my_ntohs(uint16_t x) { return ntohs(x); }
7+
8+
#undef htonl
9+
#undef htons
10+
#undef ntohl
11+
#undef ntohs
12+
13+
uint32_t htonl(uint32_t x) { return my_htonl(x); }
14+
uint32_t htons(uint16_t x) { return my_htons(x); }
15+
uint32_t ntohl(uint32_t x) { return my_ntohl(x); }
16+
uint32_t ntohs(uint16_t x) { return my_ntohs(x); }

network.cabal

+3
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ library
176176
temporary
177177

178178
if os(haiku)
179+
c-sources:
180+
cbits/swap.c
181+
179182
extra-libraries:
180183
network
181184

0 commit comments

Comments
 (0)