From a3f1aba6f0d2c7c884878962cf22136936bfcb8f Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 23 Jul 2010 20:57:36 -0700 Subject: [PATCH] Code Cleanup - Reorganized sort_compare code to make certain shortcuts occur earlier in processing. --- src/Table.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Table.cpp b/src/Table.cpp index c2ae41216..27aadb4ae 100644 --- a/src/Table.cpp +++ b/src/Table.cpp @@ -604,6 +604,14 @@ bool sort_compare (int left, int right) Grid::Cell* cell_left = table->mData.byRow (left, column); Grid::Cell* cell_right = table->mData.byRow (right, column); + // Equally NULL - next column. + if (cell_left == NULL && cell_right == NULL) + continue; + + // Equal - next column + if (cell_left && cell_right && *cell_left == *cell_right) + continue; + // nothing < something. if (cell_left == NULL && cell_right != NULL) return (sort_type == Table::ascendingNumeric || @@ -622,14 +630,6 @@ bool sort_compare (int left, int right) sort_type == Table::ascendingDueDate || sort_type == Table::ascendingPeriod) ? false : true; - // Equally NULL - next column. - if (cell_left == NULL && cell_right == NULL) - continue; - - // Equal - next column - if (cell_left && cell_right && *cell_left == *cell_right) - continue; - // Differing data - do a proper comparison. if (cell_left && cell_right) {