From 39456a3243f4548688574d1556fcca45351a1310 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 25 Jul 2012 23:14:15 -0400 Subject: [PATCH] Performance - Moved an expensive operation inside an if statement. --- src/rules.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/rules.cpp b/src/rules.cpp index 4d7a6b024..8bcf7e543 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -214,43 +214,46 @@ static void colorizeKeyword (Task& task, const std::string& rule, const Color& b //////////////////////////////////////////////////////////////////////////////// static void colorizeDue (Task& task, const Color& base, Color& c) { + if (task.has ("due")) + { Task::status status = task.getStatus (); - - if (task.has ("due") && - status != Task::completed && + if (status != Task::completed && status != Task::deleted) { if (getDueState (task.get ("due")) == 1) c.blend (base); } + } } //////////////////////////////////////////////////////////////////////////////// static void colorizeDueToday (Task& task, const Color& base, Color& c) { + if (task.has ("due")) + { Task::status status = task.getStatus (); - - if (task.has ("due") && - status != Task::completed && + if (status != Task::completed && status != Task::deleted) { if (getDueState (task.get ("due")) == 2) c.blend (base); } + } } //////////////////////////////////////////////////////////////////////////////// static void colorizeOverdue (Task& task, const Color& base, Color& c) { + if (task.has ("due")) + { Task::status status = task.getStatus (); - - if (task.has ("due") && - status != Task::completed && + if (status != Task::completed && status != Task::deleted) { if (getDueState (task.get ("due")) == 3) c.blend (base); } + } } ////////////////////////////////////////////////////////////////////////////////