diff options
author | Lee Salzman <[email protected]> | 2017-05-06 14:55:03 -0400 |
---|---|---|
committer | Lee Salzman <[email protected]> | 2017-05-06 14:55:03 -0400 |
commit | 3ae5af4548d4d0fbf9335f415d14897ce231a5a1 (patch) | |
tree | f998314a5e7d1388718d8d120a7e42f52b12cfdf /unix.c | |
parent | f46fee0acc8e243b2b6910b09693f93c3aad775f (diff) | |
download | enet-3ae5af4548d4d0fbf9335f415d14897ce231a5a1.tar.gz enet-3ae5af4548d4d0fbf9335f415d14897ce231a5a1.zip |
add portable enet_address_set_host_ip that can properly parse broadcast address
Diffstat (limited to 'unix.c')
-rw-r--r-- | unix.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -102,6 +102,19 @@ enet_time_set (enet_uint32 newTimeBase) } int +enet_address_set_host_ip (ENetAddress * address, const char * name) +{ +#ifdef HAS_INET_PTON + if (! inet_pton (AF_INET, name, & address -> host)) +#else + if (! inet_aton (name, (struct in_addr *) & address -> host)) +#endif + return -1; + + return 0; +} + +int enet_address_set_host (ENetAddress * address, const char * name) { #ifdef HAS_GETADDRINFO @@ -153,14 +166,7 @@ enet_address_set_host (ENetAddress * address, const char * name) } #endif -#ifdef HAS_INET_PTON - if (! inet_pton (AF_INET, name, & address -> host)) -#else - if (! inet_aton (name, (struct in_addr *) & address -> host)) -#endif - return -1; - - return 0; + return enet_address_set_host_ip (address, name); } int |