]> sjero.net Git - wget/blobdiff - src/host.c
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / src / host.c
index a13953b0ca30702f0f20d54777c4a36fadc61af5..11de5944352d91d6b805b8bc00ad832ee8097ca3 100644 (file)
@@ -1,11 +1,11 @@
 /* Host name resolution and matching.
-   Copyright (C) 1996-2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2006 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
  (at your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+along with Wget.  If not, see <http://www.gnu.org/licenses/>.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -265,7 +264,7 @@ address_list_from_ipv4_addresses (char **vec)
     {
       ip_address *ip = &al->addresses[i];
       ip->family = AF_INET;
-      memcpy (ADDRESS_IPV4_DATA (ip), vec[i], 4);
+      memcpy (IP_INADDR_DATA (ip), vec[i], 4);
     }
 
   return al;
@@ -857,26 +856,22 @@ sufmatch (const char **list, const char *what)
   return false;
 }
 
-static int
-host_cleanup_mapper (void *key, void *value, void *arg_ignored)
-{
-  struct address_list *al;
-
-  xfree (key);                 /* host */
-
-  al = (struct address_list *)value;
-  assert (al->refcount == 1);
-  address_list_delete (al);
-
-  return 0;
-}
-
 void
 host_cleanup (void)
 {
   if (host_name_addresses_map)
     {
-      hash_table_map (host_name_addresses_map, host_cleanup_mapper, NULL);
+      hash_table_iterator iter;
+      for (hash_table_iterate (host_name_addresses_map, &iter);
+          hash_table_iter_next (&iter);
+          )
+       {
+         char *host = iter.key;
+         struct address_list *al = iter.value;
+         xfree (host);
+         assert (al->refcount == 1);
+         address_list_delete (al);
+       }
       hash_table_destroy (host_name_addresses_map);
       host_name_addresses_map = NULL;
     }