Skip to content

Commit

Permalink
haiku: add wrappers for ntohl et al.
Browse files Browse the repository at this point in the history
* These are defined as macros.
  • Loading branch information
jessicah committed Jun 6, 2023
1 parent 9f633e4 commit 668089b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cbits/swap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <netinet/in.h>

static uint32_t my_htonl(uint32_t x) { return htonl(x); }
static uint16_t my_htons(uint16_t x) { return htons(x); }
static uint32_t my_ntohl(uint32_t x) { return ntohl(x); }
static uint32_t my_ntohs(uint16_t x) { return ntohs(x); }

#undef htonl
#undef htons
#undef ntohl
#undef ntohs

uint32_t htonl(uint32_t x) { return my_htonl(x); }
uint32_t htons(uint16_t x) { return my_htons(x); }
uint32_t ntohl(uint32_t x) { return my_ntohl(x); }
uint32_t ntohs(uint16_t x) { return my_ntohs(x); }
3 changes: 3 additions & 0 deletions network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ library
temporary

if os(haiku)
c-sources:
cbits/swap.c

extra-libraries:
network

Expand Down

0 comments on commit 668089b

Please sign in to comment.