From 7fba0317d05effab1f1c3cc1a4c40163669631af Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 2 Nov 2013 14:20:20 +0100 Subject: [PATCH] document: Remove duplicated code. Since document_compare_by_tab_order_reverse does the exact reverse of document_compare_by_tab_order the code need not to be duplicated. Instead document_compare_by_tab_order can be called and the return value be reversed. --- src/document.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/document.c b/src/document.c index efa8b277..0c1fcd6f 100644 --- a/src/document.c +++ b/src/document.c @@ -3670,20 +3670,7 @@ gint document_compare_by_tab_order(gconstpointer a, gconstpointer b) */ gint document_compare_by_tab_order_reverse(gconstpointer a, gconstpointer b) { - GeanyDocument *doc_a = *((GeanyDocument**) a); - GeanyDocument *doc_b = *((GeanyDocument**) b); - gint notebook_position_doc_a; - gint notebook_position_doc_b; - - notebook_position_doc_a = document_get_notebook_page(doc_a); - notebook_position_doc_b = document_get_notebook_page(doc_b); - - if (notebook_position_doc_a < notebook_position_doc_b) - return 1; - if (notebook_position_doc_a > notebook_position_doc_b) - return -1; - /* equality */ - return 0; + return -1 * document_compare_by_tab_order(a, b); }