aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2021-02-02 08:30:59 -0800
committerLeandro Pereira <leandro@hardinfo.org>2021-02-02 08:30:59 -0800
commit60226a4bcf23eb73c69ce13177a827b4436ff102 (patch)
treed2a6188e52c30524339e6a1e2e900f5ee33c234e
parenta72881a1d25b2b1ea7718c5e2f76b92ee43d8ef8 (diff)
Fix build warning related to pcid_cmp_by_addy()'s prototype
-rw-r--r--hardinfo/pci_util.c14
-rw-r--r--includes/pci_util.h2
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;