# HG changeset patch # User alex # Date 1177610682 0 # Node ID 612d19cb9550350d2e3b018018939dbd046a749d # Parent b6b8a9836cf9298bcd9aa3b9e2aece1bc2c5df6b move resolve_host from tcp.c to os_support.c as it is used widely diff -r b6b8a9836cf9 -r 612d19cb9550 os_support.c --- a/os_support.c Thu Apr 26 18:00:28 2007 +0000 +++ b/os_support.c Thu Apr 26 18:04:42 2007 +0000 @@ -71,10 +71,12 @@ } #endif /* !defined(HAVE_LOCALTIME_R) */ -#if !defined(HAVE_INET_ATON) && defined(CONFIG_NETWORK) +#ifdef CONFIG_NETWORK +#include "network.h" + +#if !defined(HAVE_INET_ATON) #include #include -#include "network.h" int inet_aton (const char * str, struct in_addr * add) { @@ -97,7 +99,22 @@ return 1; } -#endif /* !defined(HAVE_INET_ATON) && defined(CONFIG_NETWORK) */ +#endif /* !defined(HAVE_INET_ATON) */ + +/* resolve host with also IP address parsing */ +int resolve_host(struct in_addr *sin_addr, const char *hostname) +{ + struct hostent *hp; + + if (!inet_aton(hostname, sin_addr)) { + hp = gethostbyname(hostname); + if (!hp) + return -1; + memcpy(sin_addr, hp->h_addr, sizeof(struct in_addr)); + } + return 0; +} +#endif /* CONFIG_NETWORK */ #ifdef CONFIG_FFSERVER #ifndef HAVE_SYS_POLL_H diff -r b6b8a9836cf9 -r 612d19cb9550 tcp.c --- a/tcp.c Thu Apr 26 18:00:28 2007 +0000 +++ b/tcp.c Thu Apr 26 18:04:42 2007 +0000 @@ -28,20 +28,6 @@ int fd; } TCPContext; -/* resolve host with also IP address parsing */ -int resolve_host(struct in_addr *sin_addr, const char *hostname) -{ - struct hostent *hp; - - if (!inet_aton(hostname, sin_addr)) { - hp = gethostbyname(hostname); - if (!hp) - return -1; - memcpy(sin_addr, hp->h_addr, sizeof(struct in_addr)); - } - return 0; -} - /* return non zero if error */ static int tcp_open(URLContext *h, const char *uri, int flags) {