Sort extensions properly
authorMatthias Clasen <mclasen@redhat.com>
Fri, 3 Sep 2010 23:03:34 +0000 (19:03 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 3 Sep 2010 23:03:34 +0000 (19:03 -0400)
Just taking the difference of the priorities has overflow issues,
as pointed out in bug 623069.

gio/giomodule.c

index 39a38ff5397e5cf07594d49276838c2d9733f04b..83f4cc788c88742af9d5d1e8aefc6c50b2c3e7fc 100644 (file)
@@ -791,7 +791,13 @@ extension_prio_compare (gconstpointer  a,
 {
   const GIOExtension *extension_a = a, *extension_b = b;
 
-  return extension_b->priority - extension_a->priority;
+  if (extension_a->priority > extension_b->priority)
+    return -1;
+
+  if (extension_b->priority > extension_a->priority)
+    return 1;
+
+  return 0;
 }
 
 /**