1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Removed address_list_from_single.

This commit is contained in:
hniksic 2003-10-31 02:50:03 -08:00
parent add61a2d9c
commit dbe01ae695
2 changed files with 16 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2003-10-31 Hrvoje Niksic <hniksic@xemacs.org>
* host.c (address_list_from_single): Removed.
(address_list_from_ipv4_addresses): Renamed from
address_list_from_vector.
2003-10-31 Hrvoje Niksic <hniksic@xemacs.org> 2003-10-31 Hrvoje Niksic <hniksic@xemacs.org>
* sysdep.h (CLOSE): Don't call close on file descriptors less than * sysdep.h (CLOSE): Don't call close on file descriptors less than

View File

@ -268,10 +268,11 @@ address_list_from_addrinfo (const struct addrinfo *ai)
return al; return al;
} }
#else #else
/* Create an address_list out of a NULL-terminated vector of /* Create an address_list from a NULL-terminated vector of IPv4
addresses, as returned by gethostbyname. */ addresses. This kind of vector is returned by gethostbyname. */
static struct address_list * static struct address_list *
address_list_from_vector (char **h_addr_list) address_list_from_ipv4_addresses (char **h_addr_list)
{ {
int count, i; int count, i;
struct address_list *al = xmalloc (sizeof (struct address_list)); struct address_list *al = xmalloc (sizeof (struct address_list));
@ -296,23 +297,6 @@ address_list_from_vector (char **h_addr_list)
return al; return al;
} }
/* Like address_list_from_vector, but initialized with a single
address. */
static struct address_list *
address_list_from_single (const ip_address *addr)
{
struct address_list *al = xmalloc (sizeof (struct address_list));
al->count = 1;
al->faulty = 0;
al->addresses = xmalloc (sizeof (ip_address));
al->from_cache = 0;
al->refcount = 1;
memcpy (al->addresses, addr, sizeof (ip_address));
return al;
}
#endif #endif
static void static void
@ -536,10 +520,10 @@ lookup_host (const char *host, int flags)
{ {
/* The return value of inet_addr is in network byte order, so /* The return value of inet_addr is in network byte order, so
we can just copy it to IP. */ we can just copy it to IP. */
ip_address ip; char **vec[2];
ip.type = IPV4_ADDRESS; vec[0] = (char *)&addr_ipv4;
memcpy (ADDRESS_IPV4_DATA (&ip), &addr_ipv4, 4); vec[1] = NULL;
return address_list_from_single (&ip); return address_list_from_ipv4_addresses (vec);
} }
} }
#endif #endif
@ -598,9 +582,8 @@ lookup_host (const char *host, int flags)
return NULL; return NULL;
} }
assert (hptr->h_length == 4); assert (hptr->h_length == 4);
/* Do all systems have h_addr_list, or is it a newer thing? If /* Do older systems have h_addr_list? */
the latter, use address_list_from_single. */ al = address_list_from_ipv4_addresses (hptr->h_addr_list);
al = address_list_from_vector (hptr->h_addr_list);
} }
#endif #endif