mm-kernel-device: give cmp a total order

This allows MMKernelDevice::cmp to compare two kernel devices
with different object types, which means that subclasses can
continue to only handle comparisons with their own type. The
order may not be stable across builds.
This commit is contained in:
Eric Caruso
2020-06-17 16:19:07 -07:00
parent 12ea728112
commit 9d31cbaa2d
+3
View File
@@ -203,6 +203,9 @@ mm_kernel_device_cmp (MMKernelDevice *a,
g_return_val_if_fail (MM_IS_KERNEL_DEVICE (a), FALSE);
g_return_val_if_fail (MM_IS_KERNEL_DEVICE (b), FALSE);
if (G_OBJECT_TYPE (a) != G_OBJECT_TYPE (b))
return G_OBJECT_TYPE (a) < G_OBJECT_TYPE (b);
return (MM_KERNEL_DEVICE_GET_CLASS (a)->cmp ?
MM_KERNEL_DEVICE_GET_CLASS (a)->cmp (a, b) :
FALSE);