Several functions are shared by qsort and hash_ops or Prioq.
This makes these functions explicitly specify argument type,
and cast to __compar_fn_t where necessary.
string_hash_func(m->interface, state);
}
-static int member_compare_func(const void *a, const void *b) {
- const Member *x = a, *y = b;
+static int member_compare_func(const Member *x, const Member *y) {
int d;
assert(x);
static int introspect(int argc, char **argv, void *userdata) {
static const struct hash_ops member_hash_ops = {
.hash = member_hash_func,
- .compare = member_compare_func,
+ .compare = (__compar_fn_t) member_compare_func,
};
static const XMLIntrospectOps ops = {
siphash24_compress(&id->port_id_size, sizeof(id->port_id_size), state);
}
-static int lldp_neighbor_id_compare_func(const void *a, const void *b) {
- const LLDPNeighborID *x = a, *y = b;
+int lldp_neighbor_id_compare_func(const LLDPNeighborID *x, const LLDPNeighborID *y) {
int r;
r = memcmp(x->chassis_id, y->chassis_id, MIN(x->chassis_id_size, y->chassis_id_size));
const struct hash_ops lldp_neighbor_id_hash_ops = {
.hash = lldp_neighbor_id_hash_func,
- .compare = lldp_neighbor_id_compare_func
+ .compare = (__compar_fn_t) lldp_neighbor_id_compare_func,
};
int lldp_neighbor_prioq_compare_func(const void *a, const void *b) {
}
extern const struct hash_ops lldp_neighbor_id_hash_ops;
+int lldp_neighbor_id_compare_func(const LLDPNeighborID *x, const LLDPNeighborID *y);
int lldp_neighbor_prioq_compare_func(const void *a, const void *b);
sd_lldp_neighbor *lldp_neighbor_unlink(sd_lldp_neighbor *n);
}
static int neighbor_compare_func(sd_lldp_neighbor * const *a, sd_lldp_neighbor * const *b) {
- return lldp_neighbor_id_hash_ops.compare(&(*a)->id, &(*b)->id);
+ return lldp_neighbor_id_compare_func(&(*a)->id, &(*b)->id);
}
static int on_timer_event(sd_event_source *s, uint64_t usec, void *userdata) {