#include "unaligned.h"
static void lldp_neighbor_id_hash_func(const LLDPNeighborID *id, struct siphash *state) {
+ assert(id);
+ assert(state);
+
siphash24_compress(id->chassis_id, id->chassis_id_size, state);
siphash24_compress(&id->chassis_id_size, sizeof(id->chassis_id_size), state);
siphash24_compress(id->port_id, id->port_id_size, state);
}
int lldp_neighbor_id_compare_func(const LLDPNeighborID *x, const LLDPNeighborID *y) {
+ assert(x);
+ assert(y);
+
return memcmp_nn(x->chassis_id, x->chassis_id_size, y->chassis_id, y->chassis_id_size)
?: memcmp_nn(x->port_id, x->port_id_size, y->port_id, y->port_id_size);
}
int lldp_neighbor_prioq_compare_func(const void *a, const void *b) {
const sd_lldp_neighbor *x = a, *y = b;
+ assert(x);
+ assert(y);
+
return CMP(x->until, y->until);
}
return 0;
}
-static int neighbor_compare_func(sd_lldp_neighbor * const *a, sd_lldp_neighbor * const *b) {
- return lldp_neighbor_id_compare_func(&(*a)->id, &(*b)->id);
-}
-
static int on_timer_event(sd_event_source *s, uint64_t usec, void *userdata) {
sd_lldp_rx *lldp_rx = userdata;
int r;
lldp_rx->event_priority, "lldp-rx-timer", true);
}
+static inline int neighbor_compare_func(sd_lldp_neighbor * const *a, sd_lldp_neighbor * const *b) {
+ assert(a);
+ assert(b);
+ assert(*a);
+ assert(*b);
+
+ return lldp_neighbor_id_compare_func(&(*a)->id, &(*b)->id);
+}
+
_public_ int sd_lldp_rx_get_neighbors(sd_lldp_rx *lldp_rx, sd_lldp_neighbor ***ret) {
sd_lldp_neighbor **l = NULL, *n;
int k = 0, r;