On 06/28/2012 04:46 AM, Uri Lublin wrote:
+#define INT_RETURN_IF_DIFFERENT(x, y) \ + do { gint c,d; c=(x); d=(y); if(c-d) return (c-d); } while(0) + +static gint gudev_device_compare(GUdevDevice *a, GUdevDevice *b) +{ + GUdevDeviceInfo *ai, *bi; + + g_return_val_if_fail(G_UDEV_DEVICE(a), 1); + g_return_val_if_fail(G_UDEV_DEVICE(b), -1); + + ai = a->priv->udevinfo; + bi = b->priv->udevinfo; + + INT_RETURN_IF_DIFFERENT(ai->bus, bi->bus); + INT_RETURN_IF_DIFFERENT(ai->addr, bi->addr); + INT_RETURN_IF_DIFFERENT(ai->vid, bi->vid); + INT_RETURN_IF_DIFFERENT(ai->pid, bi->pid);
Probably safer to only compare <bus, addr> and remove <pid, vid> (in case pid, vid are not initialized).
+ + return 0; +} + +
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel