diff options
-rw-r--r-- | hardinfo/pci_util.c | 14 | ||||
-rw-r--r-- | includes/pci_util.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/hardinfo/pci_util.c b/hardinfo/pci_util.c index 69150732..e96eda9c 100644 --- a/hardinfo/pci_util.c +++ b/hardinfo/pci_util.c @@ -151,9 +151,17 @@ static gboolean pci_lookup_ids(pcid *d) { return ret; } -gint pcid_cmp_by_addy(const pcid* a, const pcid* b) { - if (!a || !b) return (!!a - !!b); - return g_strcmp0(a->slot_str, b->slot_str); +gint pcid_cmp_by_addy(gconstpointer a, gconstpointer b) +{ + const struct pcid *dev_a = a; + const struct pcid *dev_b = b; + + if (!dev_a) + return !!dev_b; + if (!dev_b) + return !!dev_a; + + return g_strcmp0(dev_a->slot_str, dev_b->slot_str); } void pcid_free(pcid *s) { diff --git a/includes/pci_util.h b/includes/pci_util.h index 07b09627..498c42a8 100644 --- a/includes/pci_util.h +++ b/includes/pci_util.h @@ -58,7 +58,7 @@ typedef struct pcid { pcid *pci_get_device(uint32_t dom, uint32_t bus, uint32_t dev, uint32_t func); pcid *pci_get_device_str(const char *addy); #define pcid_new() g_new0(pcid, 1) -gint pcid_cmp_by_addy(const pcid* a, const pcid* b); +gint pcid_cmp_by_addy(gconstpointer a, gconstpointer b); void pcid_free(pcid *); typedef GSList* pcid_list; |