testbot/lib: Simplify a couple of job sorting functions.

Francois Gouget fgouget at codeweavers.com
Mon Oct 29 09:39:13 CDT 2012


---
 testbot/lib/WineTestBot/Jobs.pm |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index b56e203..de66023 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -357,24 +357,12 @@ sub CreateJobs
 
 sub CompareJobPriority
 {
-  my $Compare = $a->Priority <=> $b->Priority;
-  if ($Compare == 0)
-  {
-    $Compare = $a->Id <=> $b->Id;
-  }
-
-  return $Compare;
+  return $a->Priority <=> $b->Priority || $a->Id <=> $b->Id;
 }
 
 sub CompareTaskStatus
 {
-  my $Compare = $b->Status cmp $a->Status;
-  if ($Compare == 0)
-  {
-    $Compare = $a->No <=> $b->No;
-  }
-
-  return $Compare;
+  return $b->Status cmp $a->Status || $a->No <=> $b->No;
 }
 
 =pod
-- 
1.7.10.4




More information about the wine-patches mailing list