This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup v3 5/6] Keep the mirror list sorted properly
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin-apps at cygwin dot com
- Date: Wed, 6 Dec 2017 15:45:58 -0500
- Subject: [PATCH setup v3 5/6] Keep the mirror list sorted properly
- Authentication-results: sourceware.org; auth=none
- References: <20171206204559.4756-1-kbrown@cornell.edu>
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