projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
snmp plugin: polished a code
[collectd.git]
/
src
/
tail_csv.c
diff --git
a/src/tail_csv.c
b/src/tail_csv.c
index
f303988
..
be7cd40
100644
(file)
--- a/
src/tail_csv.c
+++ b/
src/tail_csv.c
@@
-57,7
+57,7
@@
struct instance_definition_s {
typedef struct instance_definition_s instance_definition_t;
/* Private */
typedef struct instance_definition_s instance_definition_t;
/* Private */
-static metric_definition_t *metric_head
= NULL
;
+static metric_definition_t *metric_head;
static int tcsv_submit(instance_definition_t *id, metric_definition_t *md,
value_t v, cdtime_t t) {
static int tcsv_submit(instance_definition_t *id, metric_definition_t *md,
value_t v, cdtime_t t) {
@@
-120,17
+120,17
@@
static int tcsv_read_metric(instance_definition_t *id, metric_definition_t *md,
return tcsv_submit(id, md, v, t);
}
return tcsv_submit(id, md, v, t);
}
-static
_B
ool tcsv_check_index(ssize_t index, size_t fields_num,
-
char const *name) {
+static
b
ool tcsv_check_index(ssize_t index, size_t fields_num,
+ char const *name) {
if (index < 0)
if (index < 0)
- return
1
;
+ return
true
;
else if (((size_t)index) < fields_num)
else if (((size_t)index) < fields_num)
- return
1
;
+ return
true
;
ERROR("tail_csv plugin: Metric \"%s\": Request for index %zd when "
ERROR("tail_csv plugin: Metric \"%s\": Request for index %zd when "
- "only %
zu
fields are available.",
+ "only %
" PRIsz "
fields are available.",
name, index, fields_num);
name, index, fields_num);
- return
0
;
+ return
false
;
}
static int tcsv_read_buffer(instance_definition_t *id, char *buffer,
}
static int tcsv_read_buffer(instance_definition_t *id, char *buffer,
@@
-481,7
+481,7
@@
static int tcsv_config_add_file(oconfig_item_t *ci) {
return -1;
}
return -1;
}
- s
s
nprintf(cb_name, sizeof(cb_name), "tail_csv/%s", id->path);
+ snprintf(cb_name, sizeof(cb_name), "tail_csv/%s", id->path);
status = plugin_register_complex_read(
NULL, cb_name, tcsv_read, id->interval,
status = plugin_register_complex_read(
NULL, cb_name, tcsv_read, id->interval,
@@
-490,7
+490,6
@@
static int tcsv_config_add_file(oconfig_item_t *ci) {
});
if (status != 0) {
ERROR("tail_csv plugin: Registering complex read function failed.");
});
if (status != 0) {
ERROR("tail_csv plugin: Registering complex read function failed.");
- tcsv_instance_definition_destroy(id);
return -1;
}
return -1;
}
@@
-514,7
+513,7
@@
static int tcsv_config(oconfig_item_t *ci) {
} /* int tcsv_config */
static int tcsv_init(void) { /* {{{ */
} /* int tcsv_config */
static int tcsv_init(void) { /* {{{ */
- static
_Bool have_init = 0
;
+ static
bool have_init
;
metric_definition_t *md;
if (have_init)
metric_definition_t *md;
if (have_init)
@@
-533,7
+532,7
@@
static int tcsv_init(void) { /* {{{ */
md->type, md->name);
continue;
} else if (ds->ds_num != 1) {
md->type, md->name);
continue;
} else if (ds->ds_num != 1) {
- ERROR("tail_csv plugin: The type \"%s\" has %
zu
data sources. "
+ ERROR("tail_csv plugin: The type \"%s\" has %
" PRIsz "
data sources. "
"Only types with a single data source are supported.",
ds->type, ds->ds_num);
continue;
"Only types with a single data source are supported.",
ds->type, ds->ds_num);
continue;