X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetlink.c;h=cfca46f7494084de4939288f72a95632c2fcdd44;hb=5b4053d27b6a24e2f18e678f0d8c3343b7dfad7c;hp=5c3a9f007beb656aeefcc2a81152243671243d1e;hpb=7b64cc91d3307179557b25b6ece2349a088f4294;p=collectd.git diff --git a/src/netlink.c b/src/netlink.c index 5c3a9f00..cfca46f7 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -26,6 +26,7 @@ **/ #include "collectd.h" + #include "plugin.h" #include "common.h" @@ -156,14 +157,12 @@ static int add_ignorelist (const char *dev, const char *type, static int check_ignorelist (const char *dev, const char *type, const char *type_instance) { - ir_ignorelist_t *i; - assert ((dev != NULL) && (type != NULL)); if (ir_ignorelist_head == NULL) return (ir_ignorelist_invert ? 0 : 1); - for (i = ir_ignorelist_head; i != NULL; i = i->next) + for (ir_ignorelist_t *i = ir_ignorelist_head; i != NULL; i = i->next) { /* i->device == NULL => match all devices */ if ((i->device != NULL) @@ -724,8 +723,6 @@ static int ir_read (void) int ret; unsigned int seq, portid; - size_t ifindex; - static const int type_id[] = { RTM_GETQDISC, RTM_GETTCLASS, RTM_GETTFILTER }; static const char *type_name[] = { "qdisc", "class", "filter" }; @@ -760,15 +757,14 @@ static int ir_read (void) /* `link_filter_cb' will update `iflist' which is used here to iterate * over all interfaces. */ - for (ifindex = 1; ifindex < iflist_len; ifindex++) + for (size_t ifindex = 1; ifindex < iflist_len; ifindex++) { struct tcmsg *tm; - size_t type_index; if (iflist[ifindex] == NULL) continue; - for (type_index = 0; type_index < STATIC_ARRAY_SIZE (type_id); type_index++) + for (size_t type_index = 0; type_index < STATIC_ARRAY_SIZE (type_id); type_index++) { if (check_ignorelist (iflist[ifindex], type_name[type_index], NULL)) {