projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d1fc88e
)
src/daemon/plugin.h: Change "values_len" to type "size_t".
author
Florian Forster
<octo@collectd.org>
Thu, 25 Jun 2015 09:30:46 +0000
(11:30 +0200)
committer
Florian Forster
<octo@collectd.org>
Thu, 25 Jun 2015 09:30:46 +0000
(11:30 +0200)
16 files changed:
src/curl_xml.c
patch
|
blob
|
history
src/daemon/common.c
patch
|
blob
|
history
src/daemon/plugin.c
patch
|
blob
|
history
src/daemon/plugin.h
patch
|
blob
|
history
src/daemon/utils_cache.c
patch
|
blob
|
history
src/gmond.c
patch
|
blob
|
history
src/network.c
patch
|
blob
|
history
src/powerdns.c
patch
|
blob
|
history
src/pyvalues.c
patch
|
blob
|
history
src/snmp.c
patch
|
blob
|
history
src/table.c
patch
|
blob
|
history
src/tail_csv.c
patch
|
blob
|
history
src/utils_cmd_getval.c
patch
|
blob
|
history
src/utils_db_query.c
patch
|
blob
|
history
src/write_riemann.c
patch
|
blob
|
history
src/write_riemann_threshold.c
patch
|
blob
|
history
diff --git
a/src/curl_xml.c
b/src/curl_xml.c
index
21f1b5b
..
8a466ba
100644
(file)
--- a/
src/curl_xml.c
+++ b/
src/curl_xml.c
@@
-50,7
+50,7
@@
struct cx_xpath_s /* {{{ */
char *path;
char *type;
cx_values_t *values;
char *path;
char *type;
cx_values_t *values;
-
in
t values_len;
+
size_
t values_len;
char *instance_prefix;
char *instance;
int is_table;
char *instance_prefix;
char *instance;
int is_table;
@@
-240,7
+240,7
@@
static int cx_check_type (const data_set_t *ds, cx_xpath_t *xpath) /* {{{ */
if (ds->ds_num != xpath->values_len)
{
if (ds->ds_num != xpath->values_len)
{
- WARNING ("curl_xml plugin: DataSet `%s' requires %
i values, but config talks about %i
",
+ WARNING ("curl_xml plugin: DataSet `%s' requires %
zu values, but config talks about %zu
",
xpath->type, ds->ds_num, xpath->values_len);
return (-1);
}
xpath->type, ds->ds_num, xpath->values_len);
return (-1);
}
@@
-356,7
+356,7
@@
static int cx_handle_all_value_xpaths (xmlXPathContextPtr xpath_ctx, /* {{{ */
{
value_t values[xpath->values_len];
int status;
{
value_t values[xpath->values_len];
int status;
-
in
t i;
+
size_
t i;
assert (xpath->values_len > 0);
assert (xpath->values_len == vl->values_len);
assert (xpath->values_len > 0);
assert (xpath->values_len == vl->values_len);
@@
-689,7
+689,7
@@
static int cx_config_add_values (const char *name, cx_xpath_t *xpath, /* {{{ */
xpath->values = (cx_values_t *) malloc (sizeof (cx_values_t) * ci->values_num);
if (xpath->values == NULL)
return (-1);
xpath->values = (cx_values_t *) malloc (sizeof (cx_values_t) * ci->values_num);
if (xpath->values == NULL)
return (-1);
- xpath->values_len = ci->values_num;
+ xpath->values_len =
(size_t)
ci->values_num;
/* populate cx_values_t structure */
for (i = 0; i < ci->values_num; i++)
/* populate cx_values_t structure */
for (i = 0; i < ci->values_num; i++)
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
4720399
..
cb4870c
100644
(file)
--- a/
src/daemon/common.c
+++ b/
src/daemon/common.c
@@
-1149,14
+1149,15
@@
int parse_value (const char *value_orig, value_t *ret_value, int ds_type)
int parse_values (char *buffer, value_list_t *vl, const data_set_t *ds)
{
int parse_values (char *buffer, value_list_t *vl, const data_set_t *ds)
{
-
in
t i;
+
size_
t i;
char *dummy;
char *ptr;
char *saveptr;
char *dummy;
char *ptr;
char *saveptr;
- i =
-1
;
+ i =
0
;
dummy = buffer;
saveptr = NULL;
dummy = buffer;
saveptr = NULL;
+ vl->time = 0;
while ((ptr = strtok_r (dummy, ":", &saveptr)) != NULL)
{
dummy = NULL;
while ((ptr = strtok_r (dummy, ":", &saveptr)) != NULL)
{
dummy = NULL;
@@
-1164,11
+1165,11
@@
int parse_values (char *buffer, value_list_t *vl, const data_set_t *ds)
if (i >= vl->values_len)
{
/* Make sure i is invalid. */
if (i >= vl->values_len)
{
/* Make sure i is invalid. */
- i =
vl->values_len + 1
;
+ i =
0
;
break;
}
break;
}
- if (
i == -1
)
+ if (
vl->time == 0
)
{
if (strcmp ("N", ptr) == 0)
vl->time = cdtime ();
{
if (strcmp ("N", ptr) == 0)
vl->time = cdtime ();
@@
-1187,19
+1188,19
@@
int parse_values (char *buffer, value_list_t *vl, const data_set_t *ds)
vl->time = DOUBLE_TO_CDTIME_T (tmp);
}
vl->time = DOUBLE_TO_CDTIME_T (tmp);
}
+
+ continue;
}
}
- else
- {
- if ((strcmp ("U", ptr) == 0) && (ds->ds[i].type == DS_TYPE_GAUGE))
- vl->values[i].gauge = NAN;
- else if (0 != parse_value (ptr, &vl->values[i], ds->ds[i].type))
- return -1;
- }
+
+ if ((strcmp ("U", ptr) == 0) && (ds->ds[i].type == DS_TYPE_GAUGE))
+ vl->values[i].gauge = NAN;
+ else if (0 != parse_value (ptr, &vl->values[i], ds->ds[i].type))
+ return -1;
i++;
} /* while (strtok_r) */
i++;
} /* while (strtok_r) */
- if ((ptr != NULL) || (i
!= vl->values_len
))
+ if ((ptr != NULL) || (i
== 0
))
return (-1);
return (0);
} /* int parse_values */
return (-1);
return (0);
} /* int parse_values */
diff --git
a/src/daemon/plugin.c
b/src/daemon/plugin.c
index
88a2af4
..
60bc2ae
100644
(file)
--- a/
src/daemon/plugin.c
+++ b/
src/daemon/plugin.c
@@
-2137,8
+2137,8
@@
static int plugin_dispatch_values_internal (value_list_t *vl)
if (ds->ds_num != vl->values_len)
{
ERROR ("plugin_dispatch_values: ds->type = %s: "
if (ds->ds_num != vl->values_len)
{
ERROR ("plugin_dispatch_values: ds->type = %s: "
- "(ds->ds_num = %
i
) != "
- "(vl->values_len = %
i
)",
+ "(ds->ds_num = %
zu
) != "
+ "(vl->values_len = %
zu
)",
ds->type, ds->ds_num, vl->values_len);
return (-1);
}
ds->type, ds->ds_num, vl->values_len);
return (-1);
}
diff --git
a/src/daemon/plugin.h
b/src/daemon/plugin.h
index
daea4fc
..
b1adb52
100644
(file)
--- a/
src/daemon/plugin.h
+++ b/
src/daemon/plugin.h
@@
-97,7
+97,7
@@
typedef union value_u value_t;
struct value_list_s
{
value_t *values;
struct value_list_s
{
value_t *values;
-
int
values_len;
+
size_t
values_len;
cdtime_t time;
cdtime_t interval;
char host[DATA_MAX_NAME_LEN];
cdtime_t time;
cdtime_t interval;
char host[DATA_MAX_NAME_LEN];
@@
-125,7
+125,7
@@
typedef struct data_source_s data_source_t;
struct data_set_s
{
char type[DATA_MAX_NAME_LEN];
struct data_set_s
{
char type[DATA_MAX_NAME_LEN];
-
int
ds_num;
+
size_t
ds_num;
data_source_t *ds;
};
typedef struct data_set_s data_set_t;
data_source_t *ds;
};
typedef struct data_set_s data_set_t;
diff --git
a/src/daemon/utils_cache.c
b/src/daemon/utils_cache.c
index
7b2f958
..
b4f81cd
100644
(file)
--- a/
src/daemon/utils_cache.c
+++ b/
src/daemon/utils_cache.c
@@
-37,7
+37,7
@@
typedef struct cache_entry_s
{
char name[6 * DATA_MAX_NAME_LEN];
typedef struct cache_entry_s
{
char name[6 * DATA_MAX_NAME_LEN];
-
int
values_num;
+
size_t
values_num;
gauge_t *values_gauge;
value_t *values_raw;
/* Time contained in the package
gauge_t *values_gauge;
value_t *values_raw;
/* Time contained in the package
@@
-79,7
+79,7
@@
static int cache_compare (const cache_entry_t *a, const cache_entry_t *b)
return (strcmp (a->name, b->name));
} /* int cache_compare */
return (strcmp (a->name, b->name));
} /* int cache_compare */
-static cache_entry_t *cache_alloc (
in
t values_num)
+static cache_entry_t *cache_alloc (
size_
t values_num)
{
cache_entry_t *ce;
{
cache_entry_t *ce;
@@
-161,7
+161,7
@@
static int uc_insert (const data_set_t *ds, const value_list_t *vl,
if (ce == NULL)
{
sfree (key_copy);
if (ce == NULL)
{
sfree (key_copy);
- ERROR ("uc_insert: cache_alloc (%
i
) failed.", ds->ds_num);
+ ERROR ("uc_insert: cache_alloc (%
zu
) failed.", ds->ds_num);
return (-1);
}
return (-1);
}
@@
-565,7
+565,7
@@
gauge_t *uc_get_rate (const data_set_t *ds, const value_list_t *vl)
* values are returned. */
if (ret_num != (size_t) ds->ds_num)
{
* values are returned. */
if (ret_num != (size_t) ds->ds_num)
{
- ERROR ("utils_cache: uc_get_rate: ds[%s] has %
i
values, "
+ ERROR ("utils_cache: uc_get_rate: ds[%s] has %
zu
values, "
"but uc_get_rate_by_name returned %zu.",
ds->type, ds->ds_num, ret_num);
sfree (ret);
"but uc_get_rate_by_name returned %zu.",
ds->type, ds->ds_num, ret_num);
sfree (ret);
diff --git
a/src/gmond.c
b/src/gmond.c
index
09d7137
..
e5a5555
100644
(file)
--- a/
src/gmond.c
+++ b/
src/gmond.c
@@
-83,12
+83,12
@@
typedef struct staging_entry_s staging_entry_t;
struct metric_map_s
{
struct metric_map_s
{
- char *ganglia_name;
- char *type;
- char *type_instance;
- char *ds_name;
- int ds_type;
-
int
ds_index;
+ char
*ganglia_name;
+ char
*type;
+ char
*type_instance;
+ char
*ds_name;
+ int
ds_type;
+
size_t
ds_index;
};
typedef struct metric_map_s metric_map_t;
};
typedef struct metric_map_s metric_map_t;
@@
-166,7
+166,7
@@
static metric_map_t *metric_lookup (const char *key) /* {{{ */
return (NULL);
/* Look up the DS type and ds_index. */
return (NULL);
/* Look up the DS type and ds_index. */
- if (
(map[i].ds_type < 0) || (map[i].ds_index < 0)
) /* {{{ */
+ if (
map[i].ds_type < 0
) /* {{{ */
{
const data_set_t *ds;
{
const data_set_t *ds;
@@
-191,7
+191,7
@@
static metric_map_t *metric_lookup (const char *key) /* {{{ */
}
else
{
}
else
{
-
in
t j;
+
size_
t j;
for (j = 0; j < ds->ds_num; j++)
if (strcasecmp (ds->ds[j].name, map[i].ds_name) == 0)
for (j = 0; j < ds->ds_num; j++)
if (strcasecmp (ds->ds[j].name, map[i].ds_name) == 0)
@@
-511,7
+511,7
@@
static int staging_entry_submit (const char *host, const char *name, /* {{{ */
static int staging_entry_update (const char *host, const char *name, /* {{{ */
const char *type, const char *type_instance,
static int staging_entry_update (const char *host, const char *name, /* {{{ */
const char *type, const char *type_instance,
-
in
t ds_index, int ds_type, value_t value)
+
size_
t ds_index, int ds_type, value_t value)
{
const data_set_t *ds;
staging_entry_t *se;
{
const data_set_t *ds;
staging_entry_t *se;
@@
-525,7
+525,7
@@
static int staging_entry_update (const char *host, const char *name, /* {{{ */
if (ds->ds_num <= ds_index)
{
if (ds->ds_num <= ds_index)
{
- ERROR ("gmond plugin: Invalid index %
i: %s has only %i
data source(s).",
+ ERROR ("gmond plugin: Invalid index %
zu: %s has only %zu
data source(s).",
ds_index, ds->type, ds->ds_num);
return (-1);
}
ds_index, ds->type, ds->ds_num);
return (-1);
}
diff --git
a/src/network.c
b/src/network.c
index
e90bb39
..
13e01ba
100644
(file)
--- a/
src/network.c
+++ b/
src/network.c
@@
-772,7
+772,7
@@
static int write_part_string (char **ret_buffer, int *ret_buffer_len,
} /* int write_part_string */
static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len,
} /* int write_part_string */
static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len,
- value_t **ret_values,
in
t *ret_num_values)
+ value_t **ret_values,
size_
t *ret_num_values)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
@@
-876,7
+876,7
@@
static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len,
*ret_buffer = buffer;
*ret_buffer_len = buffer_len - pkg_length;
*ret_buffer = buffer;
*ret_buffer_len = buffer_len - pkg_length;
- *ret_num_values = pkg_numval;
+ *ret_num_values =
(size_t)
pkg_numval;
*ret_values = pkg_values;
sfree (pkg_types);
*ret_values = pkg_values;
sfree (pkg_types);
diff --git
a/src/powerdns.c
b/src/powerdns.c
index
f9f291a
..
d28f569
100644
(file)
--- a/
src/powerdns.c
+++ b/
src/powerdns.c
@@
-298,7
+298,7
@@
static void submit (const char *plugin_instance, /* {{{ */
if (ds->ds_num != 1)
{
if (ds->ds_num != 1)
{
- ERROR ("powerdns plugin: type `%s' has %
i
data sources, "
+ ERROR ("powerdns plugin: type `%s' has %
zu
data sources, "
"but I can only handle one.",
type, ds->ds_num);
return;
"but I can only handle one.",
type, ds->ds_num);
return;
diff --git
a/src/pyvalues.c
b/src/pyvalues.c
index
78e6cf9
..
4417601
100644
(file)
--- a/
src/pyvalues.c
+++ b/
src/pyvalues.c
@@
-502,9
+502,9
@@
static meta_data_t *cpy_build_meta(PyObject *meta) {
}
static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
}
static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
- int
i,
ret;
+ int ret;
const data_set_t *ds;
const data_set_t *ds;
-
int size
;
+
size_t size, i
;
value_t *value;
value_list_t value_list = VALUE_LIST_INIT;
PyObject *values = self->values, *meta = self->meta;
value_t *value;
value_list_t value_list = VALUE_LIST_INIT;
PyObject *values = self->values, *meta = self->meta;
@@
-542,15
+542,15
@@
static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
PyErr_Format(PyExc_TypeError, "meta must be a dict");
return NULL;
}
PyErr_Format(PyExc_TypeError, "meta must be a dict");
return NULL;
}
- size = (
in
t) PySequence_Length(values);
+ size = (
size_
t) PySequence_Length(values);
if (size != ds->ds_num) {
if (size != ds->ds_num) {
- PyErr_Format(PyExc_RuntimeError, "type %s needs %
d values, got %i
", value_list.type, ds->ds_num, size);
+ PyErr_Format(PyExc_RuntimeError, "type %s needs %
zu values, got %zu
", value_list.type, ds->ds_num, size);
return NULL;
}
return NULL;
}
- value =
malloc(size *
sizeof(*value));
+ value =
calloc(size,
sizeof(*value));
for (i = 0; i < size; ++i) {
PyObject *item, *num;
for (i = 0; i < size; ++i) {
PyObject *item, *num;
- item = PySequence_Fast_GET_ITEM(values, i); /* Borrowed reference. */
+ item = PySequence_Fast_GET_ITEM(values,
(int)
i); /* Borrowed reference. */
if (ds->ds->type == DS_TYPE_COUNTER) {
num = PyNumber_Long(item); /* New reference. */
if (num != NULL) {
if (ds->ds->type == DS_TYPE_COUNTER) {
num = PyNumber_Long(item); /* New reference. */
if (num != NULL) {
@@
-611,9
+611,9
@@
static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
}
static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) {
}
static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) {
- int
i,
ret;
+ int ret;
const data_set_t *ds;
const data_set_t *ds;
-
int size
;
+
size_t size, i
;
value_t *value;
value_list_t value_list = VALUE_LIST_INIT;
PyObject *values = self->values, *meta = self->meta;
value_t *value;
value_list_t value_list = VALUE_LIST_INIT;
PyObject *values = self->values, *meta = self->meta;
@@
-646,12
+646,12
@@
static PyObject *Values_write(Values *self, PyObject *args, PyObject *kwds) {
PyErr_Format(PyExc_TypeError, "values must be list or tuple");
return NULL;
}
PyErr_Format(PyExc_TypeError, "values must be list or tuple");
return NULL;
}
- size = (
in
t) PySequence_Length(values);
+ size = (
size_
t) PySequence_Length(values);
if (size != ds->ds_num) {
if (size != ds->ds_num) {
- PyErr_Format(PyExc_RuntimeError, "type %s needs %
d values, got %i
", value_list.type, ds->ds_num, size);
+ PyErr_Format(PyExc_RuntimeError, "type %s needs %
zu values, got %zu
", value_list.type, ds->ds_num, size);
return NULL;
}
return NULL;
}
- value =
malloc(size *
sizeof(*value));
+ value =
calloc(size,
sizeof(*value));
for (i = 0; i < size; ++i) {
PyObject *item, *num;
item = PySequence_Fast_GET_ITEM(values, i); /* Borrowed reference. */
for (i = 0; i < size; ++i) {
PyObject *item, *num;
item = PySequence_Fast_GET_ITEM(values, i); /* Borrowed reference. */
diff --git
a/src/snmp.c
b/src/snmp.c
index
3acadd2
..
5ad8b60
100644
(file)
--- a/
src/snmp.c
+++ b/
src/snmp.c
@@
-61,7
+61,7
@@
struct data_definition_s
instance_t instance;
char *instance_prefix;
oid_t *values;
instance_t instance;
char *instance_prefix;
oid_t *values;
-
in
t values_len;
+
size_
t values_len;
double scale;
double shift;
struct data_definition_s *next;
double scale;
double shift;
struct data_definition_s *next;
@@
-313,7
+313,7
@@
static int csnmp_config_add_data_values (data_definition_t *dd, oconfig_item_t *
dd->values = (oid_t *) malloc (sizeof (oid_t) * ci->values_num);
if (dd->values == NULL)
return (-1);
dd->values = (oid_t *) malloc (sizeof (oid_t) * ci->values_num);
if (dd->values == NULL)
return (-1);
- dd->values_len = ci->values_num;
+ dd->values_len =
(size_t)
ci->values_num;
for (i = 0; i < ci->values_num; i++)
{
for (i = 0; i < ci->values_num; i++)
{
@@
-459,7
+459,7
@@
static int csnmp_config_add_data (oconfig_item_t *ci)
return (-1);
}
return (-1);
}
- DEBUG ("snmp plugin: dd = { name = %s, type = %s, is_table = %s, values_len = %
i
}",
+ DEBUG ("snmp plugin: dd = { name = %s, type = %s, is_table = %s, values_len = %
zu
}",
dd->name, dd->type, (dd->is_table != 0) ? "true" : "false", dd->values_len);
if (data_head == NULL)
dd->name, dd->type, (dd->is_table != 0) ? "true" : "false", dd->values_len);
if (data_head == NULL)
@@
-1220,7
+1220,7
@@
static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat
csnmp_list_instances_t *instance_list_ptr;
csnmp_table_values_t **value_table_ptr;
csnmp_list_instances_t *instance_list_ptr;
csnmp_table_values_t **value_table_ptr;
-
in
t i;
+
size_
t i;
_Bool have_more;
oid_t current_suffix;
_Bool have_more;
oid_t current_suffix;
@@
-1235,7
+1235,7
@@
static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat
instance_list_ptr = instance_list;
instance_list_ptr = instance_list;
- value_table_ptr = calloc (
(size_t)
data->values_len, sizeof (*value_table_ptr));
+ value_table_ptr = calloc (data->values_len, sizeof (*value_table_ptr));
if (value_table_ptr == NULL)
return (-1);
for (i = 0; i < data->values_len; i++)
if (value_table_ptr == NULL)
return (-1);
for (i = 0; i < data->values_len; i++)
@@
-1416,7
+1416,7
@@
static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
if (ds->ds_num != data->values_len)
{
if (ds->ds_num != data->values_len)
{
- ERROR ("snmp plugin: DataSet `%s' requires %
i values, but config talks about %i
",
+ ERROR ("snmp plugin: DataSet `%s' requires %
zu values, but config talks about %zu
",
data->type, ds->ds_num, data->values_len);
return (-1);
}
data->type, ds->ds_num, data->values_len);
return (-1);
}
@@
-1680,7
+1680,7
@@
static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
if (ds->ds_num != data->values_len)
{
if (ds->ds_num != data->values_len)
{
- ERROR ("snmp plugin: DataSet `%s' requires %
i values, but config talks about %i
",
+ ERROR ("snmp plugin: DataSet `%s' requires %
zu values, but config talks about %zu
",
data->type, ds->ds_num, data->values_len);
return (-1);
}
data->type, ds->ds_num, data->values_len);
return (-1);
}
diff --git
a/src/table.c
b/src/table.c
index
beded1a
..
98858d2
100644
(file)
--- a/
src/table.c
+++ b/
src/table.c
@@
-352,9
+352,9
@@
static int tbl_prepare (tbl_t *tbl)
return -1;
}
return -1;
}
- if (res->values_num !=
(size_t)
res->ds->ds_num) {
+ if (res->values_num != res->ds->ds_num) {
log_err ("Invalid type \"%s\". Expected %zu data source%s, "
log_err ("Invalid type \"%s\". Expected %zu data source%s, "
- "got %
i
.", res->type, res->values_num,
+ "got %
zu
.", res->type, res->values_num,
(1 == res->values_num) ? "" : "s",
res->ds->ds_num);
return -1;
(1 == res->values_num) ? "" : "s",
res->ds->ds_num);
return -1;
diff --git
a/src/tail_csv.c
b/src/tail_csv.c
index
a1ee249
..
15bc5da
100644
(file)
--- a/
src/tail_csv.c
+++ b/
src/tail_csv.c
@@
-542,7
+542,7
@@
static int tcsv_init(void) { /* {{{ */
}
else if (ds->ds_num != 1)
{
}
else if (ds->ds_num != 1)
{
- ERROR ("tail_csv plugin: The type \"%s\" has %
i
data sources. "
+ ERROR ("tail_csv plugin: The type \"%s\" has %
zu
data sources. "
"Only types with a single data soure are supported.",
ds->type, ds->ds_num);
continue;
"Only types with a single data soure are supported.",
ds->type, ds->ds_num);
continue;
diff --git
a/src/utils_cmd_getval.c
b/src/utils_cmd_getval.c
index
196b45e
..
8cbb9b2
100644
(file)
--- a/
src/utils_cmd_getval.c
+++ b/
src/utils_cmd_getval.c
@@
-131,18
+131,18
@@
int handle_getval (FILE *fh, char *buffer)
return (-1);
}
return (-1);
}
- if (
(size_t)
ds->ds_num != values_num)
+ if (ds->ds_num != values_num)
{
{
- ERROR ("ds[%s]->ds_num = %
i
, "
- "but uc_get_rate_by_name returned %u values.",
- ds->type, ds->ds_num,
(unsigned int)
values_num);
+ ERROR ("ds[%s]->ds_num = %
zu
, "
+ "but uc_get_rate_by_name returned %
z
u values.",
+ ds->type, ds->ds_num, values_num);
print_to_socket (fh, "-1 Error reading value from cache.\n");
sfree (values);
sfree (identifier_copy);
return (-1);
}
print_to_socket (fh, "-1 Error reading value from cache.\n");
sfree (values);
sfree (identifier_copy);
return (-1);
}
- print_to_socket (fh, "%
u Value%s found\n", (unsigned int)
values_num,
+ print_to_socket (fh, "%
zu Value%s found\n",
values_num,
(values_num == 1) ? "" : "s");
for (i = 0; i < values_num; i++)
{
(values_num == 1) ? "" : "s");
for (i = 0; i < values_num; i++)
{
diff --git
a/src/utils_db_query.c
b/src/utils_db_query.c
index
9c84937
..
d2b8117
100644
(file)
--- a/
src/utils_db_query.c
+++ b/
src/utils_db_query.c
@@
-371,10
+371,10
@@
static int udb_result_prepare_result (udb_result_t const *r, /* {{{ */
BAIL_OUT (-1);
}
BAIL_OUT (-1);
}
- if (
((size_t) prep_area->ds->ds_num)
!= r->values_num)
+ if (
prep_area->ds->ds_num
!= r->values_num)
{
ERROR ("db query utils: udb_result_prepare_result: The type `%s' "
{
ERROR ("db query utils: udb_result_prepare_result: The type `%s' "
- "requires exactly %
i
value%s, but the configuration specifies %zu.",
+ "requires exactly %
zu
value%s, but the configuration specifies %zu.",
r->type,
prep_area->ds->ds_num, (prep_area->ds->ds_num == 1) ? "" : "s",
r->values_num);
r->type,
prep_area->ds->ds_num, (prep_area->ds->ds_num == 1) ? "" : "s",
r->values_num);
diff --git
a/src/write_riemann.c
b/src/write_riemann.c
index
a09c723
..
93bf853
100644
(file)
--- a/
src/write_riemann.c
+++ b/
src/write_riemann.c
@@
-778,35
+778,33
@@
static int riemann_notification(const notification_t *n, user_data_t *ud) /* {{{
} /* }}} int riemann_notification */
static int riemann_write(const data_set_t *ds, /* {{{ */
} /* }}} int riemann_notification */
static int riemann_write(const data_set_t *ds, /* {{{ */
- const value_list_t *vl,
- user_data_t *ud)
+
const value_list_t *vl,
+
user_data_t *ud)
{
int status = 0;
int statuses[vl->values_len];
struct riemann_host *host = ud->data;
{
int status = 0;
int statuses[vl->values_len];
struct riemann_host *host = ud->data;
- Msg *msg;
-
- if (host->check_thresholds)
- write_riemann_threshold_check(ds, vl, statuses);
-
- if (host->use_tcp == 1 && host->batch_mode) {
-
- riemann_batch_add_value_list (host, ds, vl, statuses);
+ if (host->check_thresholds) {
+ status = write_riemann_threshold_check(ds, vl, statuses);
+ if (status != 0)
+ return status;
+ }
- } else {
+ if (host->use_tcp == 1 && host->batch_mode) {
+ riemann_batch_add_value_list (host, ds, vl, statuses);
+ } else {
+ Msg *msg = riemann_value_list_to_protobuf (host, ds, vl, statuses);
+ if (msg == NULL)
+ return (-1);
-
msg = riemann_value_list_to_protobuf (host, ds, vl, statuses
);
-
if (msg == NULL
)
-
return (-1
);
+
status = riemann_send (host, msg
);
+
if (status != 0
)
+
ERROR ("write_riemann plugin: riemann_send failed with status %i", status
);
- status = riemann_send (host, msg);
- if (status != 0)
- ERROR ("write_riemann plugin: riemann_send failed with status %i",
- status);
+ riemann_msg_protobuf_free (msg);
+ }
- riemann_msg_protobuf_free (msg);
- }
return status;
} /* }}} int riemann_write */
return status;
} /* }}} int riemann_write */
diff --git
a/src/write_riemann_threshold.c
b/src/write_riemann_threshold.c
index
6d5af03
..
515480e
100644
(file)
--- a/
src/write_riemann_threshold.c
+++ b/
src/write_riemann_threshold.c
@@
-202,7
+202,9
@@
int write_riemann_threshold_check (const data_set_t *ds, const value_list_t *vl,
gauge_t *values;
int status;
gauge_t *values;
int status;
+ assert (vl->values_len > 0);
memset(statuses, 0, vl->values_len * sizeof(*statuses));
memset(statuses, 0, vl->values_len * sizeof(*statuses));
+
if (threshold_tree == NULL)
return 0;
if (threshold_tree == NULL)
return 0;