[PATCH setup v3 6/6] Display area and location of mirrors, and add these to the sort key

Ken Brown kbrown@cornell.edu
Wed Dec 6 20:46:00 GMT 2017


From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>

Also change site_list_type::operator== to compare URLs rather than
keys, since the key no longer depends only on the URL.
---
 site.cc | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/site.cc b/site.cc
index 1dd42d8..72e8e80 100644
--- a/site.cc
+++ b/site.cc
@@ -187,8 +187,14 @@ site_list_type::site_list_type (const string &_url,
       idx = 0;
   } while (idx > 0);
   key += url;
-  /* Display the full URL (without trailing slash) of a non-mirror.  */
-  if (!from_mirrors_lst)
+  /* Display the area and location of a mirror; display the full URL
+     (without the trailing slash) of a non-mirror.  */
+  if (from_mirrors_lst)
+    {
+      displayed_url = area + " - " + location + " - " + displayed_url;
+      key = area + " " + location + " " + displayed_url;
+    }
+  else
     {
       displayed_url = url;
       displayed_url.erase (displayed_url.end () - 1);
@@ -222,7 +228,7 @@ site_list_type::operator= (site_list_type const &rhs)
 bool
 site_list_type::operator == (site_list_type const &rhs) const
 {
-  return stricmp (key.c_str(), rhs.key.c_str()) == 0; 
+  return stricmp (url.c_str(), rhs.url.c_str()) == 0;
 }
 
 bool
-- 
2.15.1



More information about the Cygwin-apps mailing list