Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #878 from denis-sh/add-attributes-to-`core.sys.pos…
Browse files Browse the repository at this point in the history
…ix.{arpa.inet,sys.uio}`

Add attributes to `core.sys.posix.{arpa.inet,sys.uio}`.
  • Loading branch information
dnadlinger committed Jul 24, 2014
2 parents 3075fcd + e4e9563 commit 452fc6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/core/sys/posix/arpa/inet.d
Expand Up @@ -19,7 +19,7 @@ public import core.stdc.inttypes; // for uint32_t, uint16_t
public import core.sys.posix.sys.socket; // for socklen_t

version (Posix):
extern (C):
extern (C) nothrow @nogc:

//
// Required
Expand Down Expand Up @@ -61,10 +61,13 @@ version( linux )

enum INET_ADDRSTRLEN = 16;

@trusted pure
{
uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);
uint32_t ntohl(uint32_t);
uint16_t ntohs(uint16_t);
}

in_addr_t inet_addr(in char*);
char* inet_ntoa(in_addr);
Expand All @@ -83,10 +86,13 @@ else version( OSX )

enum INET_ADDRSTRLEN = 16;

@trusted pure
{
uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);
uint32_t ntohl(uint32_t);
uint16_t ntohs(uint16_t);
}

in_addr_t inet_addr(in char*);
char* inet_ntoa(in_addr);
Expand All @@ -105,10 +111,13 @@ else version( FreeBSD )

enum INET_ADDRSTRLEN = 16;

@trusted pure
{
uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);
uint32_t ntohl(uint32_t);
uint16_t ntohs(uint16_t);
}

in_addr_t inet_addr(in char*);
char* inet_ntoa(in_addr);
Expand All @@ -126,9 +135,9 @@ else version( Android )

enum INET_ADDRSTRLEN = 16;

private
@safe pure extern (D)
{
extern (D)
private
{
uint32_t __swap32( uint32_t x )
{
Expand All @@ -143,10 +152,7 @@ else version( Android )
return byte16_swap;
}
}
}

extern (D)
{
uint32_t htonl(uint32_t x) { return __swap32(x); }
uint16_t htons(uint16_t x) { return __swap16(x); }
uint32_t ntohl(uint32_t x) { return __swap32(x); }
Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/posix/sys/uio.d
Expand Up @@ -18,7 +18,7 @@ private import core.sys.posix.config;
public import core.sys.posix.sys.types; // for ssize_t, size_t

version (Posix):
extern (C):
extern (C) nothrow @nogc:

//
// Required
Expand Down

0 comments on commit 452fc6e

Please sign in to comment.