diff --git a/src/fscache.c b/src/fscache.c
index dc0eb1194dcc95fdaa8292706fb3fb26bdb09638..33633d63247db02deb1c7a909d228557b90184c2 100644 (file)
--- a/src/fscache.c
+++ b/src/fscache.c
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include <stdio.h> /* a header needed for FILE */
63 events to collect in 13 groups
*/
static void fscache_submit (const char *section, const char *name,
- counter_t counter_value)
+ value_t value)
{
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- vl.values = values;
+ vl.values = &value;
vl.values_len = 1;
- vl.values[0].counter = counter_value;
-
sstrncpy(vl.host, hostname_g, sizeof (vl.host));
sstrncpy(vl.plugin, "fscache", sizeof (vl.plugin));
sstrncpy(vl.plugin_instance, section, sizeof (vl.plugin_instance));
char *lineptr;
char *fields[32];
int fields_num;
- int i;
/* Find the colon and replace it with a null byte */
lineptr = strchr (linebuffer, ':');
section_len--;
section[section_len] = 0;
}
- if (section_len <= 0)
+ if (section_len == 0)
continue;
fields_num = strsplit (lineptr, fields, STATIC_ARRAY_SIZE (fields));
if (fields_num <= 0)
continue;
- for (i = 0; i < fields_num; i++)
+ for (int i = 0; i < fields_num; i++)
{
char *field_name;
char *field_value_str;
- char *endptr;
- counter_t field_value_cnt;
+ value_t field_value_cnt;
+ int status;
field_name = fields[i];
assert (field_name != NULL);
*field_value_str = 0;
field_value_str++;
- errno = 0;
- endptr = NULL;
- field_value_cnt = (counter_t) strtoull (field_value_str,
- &endptr, /* base = */ 10);
- if ((errno != 0) || (endptr == field_value_str))
+ status = parse_value (field_value_str, &field_value_cnt,
+ DS_TYPE_DERIVE);
+ if (status != 0)
continue;
fscache_submit (section, field_name, field_value_cnt);