**/
#include "collectd.h"
+
#include "plugin.h"
#include "common.h"
{
ir_ignorelist_t *entry;
- entry = (ir_ignorelist_t *) malloc (sizeof (ir_ignorelist_t));
+ entry = calloc (1, sizeof (*entry));
if (entry == NULL)
return (-1);
- memset (entry, '\0', sizeof (ir_ignorelist_t));
-
if (strcasecmp (dev, "All") != 0)
{
entry->device = strdup (dev);
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)
{
char **temp;
- temp = (char **) realloc (iflist, (msg->ifi_index + 1) * sizeof (char *));
+ temp = realloc (iflist, (msg->ifi_index + 1) * sizeof (char *));
if (temp == NULL)
{
ERROR ("netlink plugin: update_iflist: realloc failed.");
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" };
/* `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))
{