summaryrefslogtreecommitdiff
path: root/src/pkg_ver_item.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg_ver_item.h')
-rw-r--r--src/pkg_ver_item.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/pkg_ver_item.h b/src/pkg_ver_item.h
index 1d2d64e1..ddbd2519 100644
--- a/src/pkg_ver_item.h
+++ b/src/pkg_ver_item.h
@@ -122,16 +122,8 @@ public:
class versort:public cwidget::widgets::sortpolicy
{
+ pkg_name_lt plt;
public:
- inline int compare(const pkg_ver_item *item1, const pkg_ver_item *item2) const
- {
- if(item1->get_version().ParentPkg()!=item2->get_version().ParentPkg())
- return strcmp(item1->get_version().ParentPkg().Name(),
- item2->get_version().ParentPkg().Name());
-
- return _system->VS->CmpVersion(item1->get_version().VerStr(), item2->get_version().VerStr());
- }
-
bool operator()(cwidget::widgets::treeitem *item1, cwidget::widgets::treeitem *item2)
{
// FIXME: this is horrible.
@@ -139,7 +131,14 @@ public:
const pkg_ver_item *pitem2=dynamic_cast<const pkg_ver_item *>(item2);
if(pitem1 && pitem2)
- return (compare(pitem1,pitem2)<0);
+ {
+ if(pitem1->get_version().ParentPkg()!=pitem2->get_version().ParentPkg())
+ return plt(pitem1->get_version().ParentPkg(),
+ pitem2->get_version().ParentPkg());
+
+ return _system->VS->CmpVersion(pitem1->get_version().VerStr(),
+ pitem2->get_version().VerStr()) < 0;
+ }
else
return false; // we shouldn't get here!
}