summaryrefslogtreecommitdiff
path: root/src/glibext/comparable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext/comparable.c')
-rw-r--r--src/glibext/comparable.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/glibext/comparable.c b/src/glibext/comparable.c
index 95e7de7..40fd110 100644
--- a/src/glibext/comparable.c
+++ b/src/glibext/comparable.c
@@ -25,6 +25,7 @@
#include "comparable-int.h"
+#include "../common/sort.h"
@@ -72,11 +73,24 @@ static void g_comparable_object_default_init(GComparableObjectInterface *iface)
int g_comparable_object_compare(const GComparableObject *object, const GComparableObject *other)
{
int result; /* Bilan à retourner */
+ GType type_a; /* Type de l'object A */
+ GType type_b; /* Type de l'object B */
GComparableObjectInterface *iface; /* Interface utilisée */
- iface = G_COMPARABLE_OBJECT_GET_IFACE(object);
+ type_a = G_OBJECT_TYPE(G_OBJECT(object));
+ type_b = G_OBJECT_TYPE(G_OBJECT(other));
- result = iface->compare(object, other);
+ assert(sizeof(GType) <= sizeof(unsigned long));
+
+ result = sort_unsigned_long(type_a, type_b);
+
+ if (result == 0)
+ {
+ iface = G_COMPARABLE_OBJECT_GET_IFACE(object);
+
+ result = iface->compare(object, other);
+
+ }
return result;