This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]