[PATCH setup v4 4/6] Keep the mirror list sorted properly

Ken Brown kbrown@cornell.edu
Sun Dec 10 17:49:00 GMT 2017


When site.cc:load_site_list() added a mirror whose URL was already in
the list, it put the new entry in the same position as the old.
Remove the old entry and merge the new one instead.
---
 site.cc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/site.cc b/site.cc
index dc9b0ee..44cd114 100644
--- a/site.cc
+++ b/site.cc
@@ -337,11 +337,9 @@ load_site_list (SiteList& theSites, char *theString)
 	  site_list_type newsite (bol, semi, semi2, semi3, true, true);
 	  SiteList::iterator i = find (theSites.begin(),
 				       theSites.end(), newsite);
-	  if (i == theSites.end())
-	    merge_site (theSites, newsite);
-	  else
-	    //TODO: remove and remerge 
-	    *i = newsite;
+	  if (i != theSites.end ())
+	    theSites.erase (i);
+	  merge_site (theSites, newsite);
 	}
         else
         {
-- 
2.15.1



More information about the Cygwin-apps mailing list