summaryrefslogtreecommitdiffhomepage
path: root/win32.c
diff options
context:
space:
mode:
authoreihrul <eihrul>2006-12-13 04:36:07 +0000
committereihrul <eihrul>2006-12-13 04:36:07 +0000
commit92f904f56a5c0f3f7f81dc37645648d9c4368bd7 (patch)
tree25012a9539552eaded9b8f97e9c6f057e466e2b5 /win32.c
parentdf636cc8f79fac3c665a9740c5803ee71f965d16 (diff)
downloadenet-92f904f56a5c0f3f7f81dc37645648d9c4368bd7.tar.gz
enet-92f904f56a5c0f3f7f81dc37645648d9c4368bd7.zip
*** empty log message ***
Diffstat (limited to 'win32.c')
-rw-r--r--win32.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/win32.c b/win32.c
index 8fdd746..5fde10d 100644
--- a/win32.c
+++ b/win32.c
@@ -74,6 +74,16 @@ enet_address_set_host (ENetAddress * address, const char * name)
}
int
+enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameLength)
+{
+ char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
+ if (addr == NULL)
+ return -1;
+ strncpy (name, addr, nameLength);
+ return 0;
+}
+
+int
enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength)
{
struct in_addr in;
@@ -83,13 +93,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng
hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET);
if (hostEntry == NULL)
- {
- char * addr = inet_ntoa (* (struct in_addr *) & address -> host);
- if (addr == NULL)
- return -1;
- strncpy (name, addr, nameLength);
- return 0;
- }
+ return enet_address_get_host_ip (address, name, nameLength);
strncpy (name, hostEntry -> h_name, nameLength);