*/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "utils_match.h"
int __attribute__((unused)) buflen)
{
cu_tail_match_t *obj = (cu_tail_match_t *) data;
- size_t i;
- for (i = 0; i < obj->matches_num; i++)
+ for (size_t i = 0; i < obj->matches_num; i++)
match_apply (obj->matches[i].match, buf);
return (0);
{
cu_tail_match_t *obj;
- obj = malloc (sizeof (*obj));
+ obj = calloc (1, sizeof (*obj));
if (obj == NULL)
return (NULL);
- memset (obj, '\0', sizeof (cu_tail_match_t));
obj->tail = cu_tail_create (filename);
if (obj->tail == NULL)
void tail_match_destroy (cu_tail_match_t *obj)
{
- size_t i;
-
if (obj == NULL)
return;
obj->tail = NULL;
}
- for (i = 0; i < obj->matches_num; i++)
+ for (size_t i = 0; i < obj->matches_num; i++)
{
cu_tail_match_match_t *match = obj->matches + i;
if (match->match != NULL)
{
cu_tail_match_match_t *temp;
- temp = (cu_tail_match_match_t *) realloc (obj->matches,
+ temp = realloc (obj->matches,
sizeof (cu_tail_match_match_t) * (obj->matches_num + 1));
if (temp == NULL)
return (-1);
if (match == NULL)
return (-1);
- user_data = malloc (sizeof (*user_data));
+ user_data = calloc (1, sizeof (*user_data));
if (user_data == NULL)
{
match_destroy (match);
return (-1);
}
- memset (user_data, '\0', sizeof (cu_tail_match_simple_t));
sstrncpy (user_data->plugin, plugin, sizeof (user_data->plugin));
if (plugin_instance != NULL)
{
char buffer[4096];
int status;
- size_t i;
status = cu_tail_read (obj->tail, buffer, sizeof (buffer), tail_callback,
(void *) obj);
return (status);
}
- for (i = 0; i < obj->matches_num; i++)
+ for (size_t i = 0; i < obj->matches_num; i++)
{
cu_tail_match_match_t *lt_match = obj->matches + i;