[PATCH setup v3 5/6] Keep the mirror list sorted properly

Ken Brown kbrown@cornell.edu
Wed Dec 6 20:46: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 98dd756..1dd42d8 100644
--- a/site.cc
+++ b/site.cc
@@ -321,11 +321,9 @@ load_site_list (SiteList& theSites, char *theString)
 	  site_list_type newsite (bol, semi, semi2, semi3, 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