projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1856 from rubenk/snmp-dont-dispatch-values-with-empty-type-instance
[collectd.git]
/
src
/
modbus.c
diff --git
a/src/modbus.c
b/src/modbus.c
index
2f685e6
..
db7d033
100644
(file)
--- a/
src/modbus.c
+++ b/
src/modbus.c
@@
-162,12
+162,10
@@
static mb_data_t *data_definitions = NULL;
static mb_data_t *data_get_by_name (mb_data_t *src, /* {{{ */
const char *name)
{
static mb_data_t *data_get_by_name (mb_data_t *src, /* {{{ */
const char *name)
{
- mb_data_t *ptr;
-
if (name == NULL)
return (NULL);
if (name == NULL)
return (NULL);
- for (ptr = src; ptr != NULL; ptr = ptr->next)
+ for (
mb_data_t *
ptr = src; ptr != NULL; ptr = ptr->next)
if (strcasecmp (ptr->name, name) == 0)
return (ptr);
if (strcasecmp (ptr->name, name) == 0)
return (ptr);
@@
-622,7
+620,6
@@
static int mb_read_data (mb_host_t *host, mb_slave_t *slave, /* {{{ */
static int mb_read_slave (mb_host_t *host, mb_slave_t *slave) /* {{{ */
{
static int mb_read_slave (mb_host_t *host, mb_slave_t *slave) /* {{{ */
{
- mb_data_t *data;
int success;
int status;
int success;
int status;
@@
-630,7
+627,7
@@
static int mb_read_slave (mb_host_t *host, mb_slave_t *slave) /* {{{ */
return (EINVAL);
success = 0;
return (EINVAL);
success = 0;
- for (data = slave->collect; data != NULL; data = data->next)
+ for (
mb_data_t *
data = slave->collect; data != NULL; data = data->next)
{
status = mb_read_data (host, slave, data);
if (status == 0)
{
status = mb_read_data (host, slave, data);
if (status == 0)
@@
-646,7
+643,6
@@
static int mb_read_slave (mb_host_t *host, mb_slave_t *slave) /* {{{ */
static int mb_read (user_data_t *user_data) /* {{{ */
{
mb_host_t *host;
static int mb_read (user_data_t *user_data) /* {{{ */
{
mb_host_t *host;
- size_t i;
int success;
int status;
int success;
int status;
@@
-656,7
+652,7
@@
static int mb_read (user_data_t *user_data) /* {{{ */
host = user_data->data;
success = 0;
host = user_data->data;
success = 0;
- for (i = 0; i < host->slaves_num; i++)
+ for (
size_t
i = 0; i < host->slaves_num; i++)
{
status = mb_read_slave (host, host->slaves + i);
if (status == 0)
{
status = mb_read_slave (host, host->slaves + i);
if (status == 0)
@@
-695,12
+691,10
@@
static void data_free_all (mb_data_t *data) /* {{{ */
static void slaves_free_all (mb_slave_t *slaves, size_t slaves_num) /* {{{ */
{
static void slaves_free_all (mb_slave_t *slaves, size_t slaves_num) /* {{{ */
{
- size_t i;
-
if (slaves == NULL)
return;
if (slaves == NULL)
return;
- for (i = 0; i < slaves_num; i++)
+ for (
size_t
i = 0; i < slaves_num; i++)
data_free_all (slaves[i].collect);
sfree (slaves);
} /* }}} void slaves_free_all */
data_free_all (slaves[i].collect);
sfree (slaves);
} /* }}} void slaves_free_all */
@@
-722,7
+716,6
@@
static int mb_config_add_data (oconfig_item_t *ci) /* {{{ */
{
mb_data_t data = { 0 };
int status;
{
mb_data_t data = { 0 };
int status;
- int i;
data.name = NULL;
data.register_type = REG_TYPE_UINT16;
data.name = NULL;
data.register_type = REG_TYPE_UINT16;
@@
-732,7
+725,7
@@
static int mb_config_add_data (oconfig_item_t *ci) /* {{{ */
if (status != 0)
return (status);
if (status != 0)
return (status);
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
{
oconfig_item_t *child = ci->children + i;
@@
-818,7
+811,6
@@
static int mb_config_set_host_address (mb_host_t *host, /* {{{ */
const char *address)
{
struct addrinfo *ai_list;
const char *address)
{
struct addrinfo *ai_list;
- struct addrinfo *ai_ptr;
int status;
if ((host == NULL) || (address == NULL))
int status;
if ((host == NULL) || (address == NULL))
@@
-842,7
+834,7
@@
static int mb_config_set_host_address (mb_host_t *host, /* {{{ */
return (status);
}
return (status);
}
- for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
+ for (
struct addrinfo *
ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next)
{
status = getnameinfo (ai_ptr->ai_addr, ai_ptr->ai_addrlen,
host->node, sizeof (host->node),
{
status = getnameinfo (ai_ptr->ai_addr, ai_ptr->ai_addrlen,
host->node, sizeof (host->node),
@@
-869,7
+861,6
@@
static int mb_config_add_slave (mb_host_t *host, oconfig_item_t *ci) /* {{{ */
{
mb_slave_t *slave;
int status;
{
mb_slave_t *slave;
int status;
- int i;
if ((host == NULL) || (ci == NULL))
return (EINVAL);
if ((host == NULL) || (ci == NULL))
return (EINVAL);
@@
-886,7
+877,7
@@
static int mb_config_add_slave (mb_host_t *host, oconfig_item_t *ci) /* {{{ */
if (status != 0)
return (status);
if (status != 0)
return (status);
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
{
oconfig_item_t *child = ci->children + i;
@@
-929,7
+920,6
@@
static int mb_config_add_host (oconfig_item_t *ci) /* {{{ */
{
mb_host_t *host;
int status;
{
mb_host_t *host;
int status;
- int i;
host = calloc (1, sizeof (*host));
if (host == NULL)
host = calloc (1, sizeof (*host));
if (host == NULL)
@@
-948,7
+938,7
@@
static int mb_config_add_host (oconfig_item_t *ci) /* {{{ */
return (EINVAL);
}
return (EINVAL);
}
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
status = 0;
{
oconfig_item_t *child = ci->children + i;
status = 0;
@@
-1037,12
+1027,10
@@
static int mb_config_add_host (oconfig_item_t *ci) /* {{{ */
static int mb_config (oconfig_item_t *ci) /* {{{ */
{
static int mb_config (oconfig_item_t *ci) /* {{{ */
{
- int i;
-
if (ci == NULL)
return (EINVAL);
if (ci == NULL)
return (EINVAL);
- for (i = 0; i < ci->children_num; i++)
+ for (i
nt i
= 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
{
oconfig_item_t *child = ci->children + i;