diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-02 19:40:03 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-02 19:40:03 +0200 |
commit | 13ec81ce3e2f77504818de0bf89a2a1edd7e0ba2 (patch) | |
tree | 73ed054d727c778c4f07bf54e7fbb2a9a3fe64e3 /interface-ip.c | |
parent | 98565127c60cba3d5b747bb9eb698e06d187f45b (diff) |
vlist: store a pointer to the real key to make lookups easier
Diffstat (limited to 'interface-ip.c')
-rw-r--r-- | interface-ip.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/interface-ip.c b/interface-ip.c index 0845169..2d7a2d0 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -13,19 +13,15 @@ static int addr_cmp(const void *k1, const void *k2, void *ptr) { - const struct device_addr *a1 = k1, *a2 = k2; - - return memcmp(&a1->mask, &a2->mask, - sizeof(*a1) - offsetof(struct device_addr, mask)); + return memcmp(k1, k2, sizeof(struct device_addr) - + offsetof(struct device_addr, mask)); } static int route_cmp(const void *k1, const void *k2, void *ptr) { - const struct device_route *r1 = k1, *r2 = k2; - - return memcmp(&r1->mask, &r2->mask, - sizeof(*r1) - offsetof(struct device_route, mask)); + return memcmp(k1, k2, sizeof(struct device_route) - + offsetof(struct device_route, mask)); } static void @@ -84,7 +80,7 @@ void interface_ip_init(struct interface *iface) { vlist_init(&iface->proto_route, route_cmp, interface_update_proto_route, - struct device_route, node); + struct device_route, node, mask); vlist_init(&iface->proto_addr, addr_cmp, interface_update_proto_addr, - struct device_addr, node); + struct device_addr, node, mask); } |