[Aptitude-devel] r2956 - in branches/aptitude-0.3/aptitude: . src/generic/problemresolver

Daniel Burrows dburrows@costa.debian.org
Fri, 08 Apr 2005 17:58:08 +0000


Author: dburrows
Date: Fri Apr  8 17:58:05 2005
New Revision: 2956

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
Log:
Only use get_id to index arrays -- don't use it to order versions
(because the underlying package system might have a more
efficient way of ordering them).

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Fri Apr  8 17:58:05 2005
@@ -2,6 +2,11 @@
 
 	* src/generic/problemresolver/problemresolver.h:
 
+	  Use operator<, not get_id(), to compare versions; use the
+	  fact that version comparisons include package comparisons.
+
+	* src/generic/problemresolver/problemresolver.h:
+
 	  Enable the closed queue, and fix solution_contents_compare to
 	  not treat all solutions as equal to one another.
 

Modified: branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/problemresolver/problemresolver.h	Fri Apr  8 17:58:05 2005
@@ -113,7 +113,7 @@
  *  PackageUniverse::package is the representation of a package; the
  *  main interesting thing about packages is that they have lists of
  *  versions.  Packages can be compared with == and <, they have
- *  unique numerical IDs, and
+ *  unique numerical IDs (retrieved via p.get_id()), and
  *  PackageUniverse::package::version_iterator lets you iterate from
  *  p.versions_begin() to p.versions_end(); dereferencing the iterator
  *  results in a PackageUniverse::version.
@@ -449,13 +449,9 @@
 
       while(i1!=a1.end() && i2!=a2.end())
 	{
-	  if(i1->first.get_id() < i2->first.get_id())
+	  if(i1->second.ver < i2->second.ver)
 	    return true;
-	  else if(i1->first.get_id() > i2->first.get_id())
-	    return false;
-	  else if(i1->second.ver.get_id() < i2->second.ver.get_id())
-	    return true;
-	  else if(i1->second.ver.get_id() > i2->second.ver.get_id())
+	  else if(i2->second.ver < i1->second.ver)
 	    return false;
 
 	  ++i1;