[gtksourceview/wip/sortlines] Use GLib types and functions for compare_line()



commit 8f52f718a1e700ab36ac366ab52155d8bf5e07f4
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat May 16 12:04:57 2015 +0200

    Use GLib types and functions for compare_line()
    
    g_strcmp0() is simpler. Use GLib types so that the code is consistent.

 gtksourceview/gtksourcebuffer.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 05a9657..8844b6b 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -2732,19 +2732,14 @@ typedef struct {
        gchar *key;  /* the key to use for the comparison */
 } SortLine;
 
-static int
-compare_line (const void *aptr,
-              const void *bptr)
+static gint
+compare_line (gconstpointer aptr,
+              gconstpointer bptr)
 {
        const SortLine *a = aptr;
        const SortLine *b = bptr;
 
-       if (a->key == NULL)
-       {
-               return b->key == NULL ? 0 : -1;
-       }
-
-       return b->key == NULL ? 1 : strcmp (a->key, b->key);
+       return g_strcmp0 (a->key, b->key);
 }
 
 static int


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]