[geany/geany] 7fba03: document: Remove duplicated code.

Thomas Martitz git-noreply at xxxxx
Wed Jan 28 14:33:52 UTC 2015


Branch:      refs/heads/master
Author:      Thomas Martitz <thomas.martitz at student.htw-berlin.de>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 28 Jan 2015 14:33:52 UTC
Commit:      7fba0317d05effab1f1c3cc1a4c40163669631af
             https://github.com/geany/geany/commit/7fba0317d05effab1f1c3cc1a4c40163669631af

Log Message:
-----------
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.


Modified Paths:
--------------
    src/document.c

Modified: src/document.c
15 lines changed, 1 insertions(+), 14 deletions(-)
===================================================================
@@ -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);
 }
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list