[Spice-devel] [PATCH spice-gtk] main: use glib sort

Marc-André Lureau marcandre.lureau at gmail.com
Wed Feb 20 03:08:55 PST 2013


Use glib sort for monitors. This allows to share the same
implementation and behaviour on various platforms.
---
 gtk/channel-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 40d27cc..fe57684 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -967,7 +967,7 @@ static void agent_msg_queue_many(SpiceMainChannel *channel, int type, const void
     g_warn_if_fail(out == NULL);
 }
 
-static int monitors_cmp(const void *p1, const void *p2)
+static int monitors_cmp(const void *p1, const void *p2, gpointer user_data)
 {
     const VDAgentMonConfig *m1 = p1;
     const VDAgentMonConfig *m2 = p2;
@@ -988,7 +988,7 @@ static void monitors_align(VDAgentMonConfig *monitors, int nmonitors)
 
     /* sort by distance from origin */
     sorted_monitors = g_memdup(monitors, nmonitors * sizeof(VDAgentMonConfig));
-    qsort(sorted_monitors, nmonitors, sizeof(VDAgentMonConfig), monitors_cmp);
+    g_qsort_with_data(sorted_monitors, nmonitors, sizeof(VDAgentMonConfig), monitors_cmp, NULL);
 
     /* super-KISS ltr alignment, feel free to improve */
     for (i = 0; i < nmonitors; i++) {
-- 
1.8.1.1.439.g50a6b54



More information about the Spice-devel mailing list