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 #1842 from rubenk/declare-loop-variable-in-for-loop-controlling...
[collectd.git]
/
src
/
collectd-nagios.c
diff --git
a/src/collectd-nagios.c
b/src/collectd-nagios.c
index
c1a8515
..
12187f3
100644
(file)
--- a/
src/collectd-nagios.c
+++ b/
src/collectd-nagios.c
@@
-128,8
+128,6
@@
static int filter_ds (size_t *values_num,
gauge_t *new_values;
char **new_names;
gauge_t *new_values;
char **new_names;
- size_t i;
-
if (match_ds_g == NULL)
return (RET_OKAY);
if (match_ds_g == NULL)
return (RET_OKAY);
@@
-148,7
+146,7
@@
static int filter_ds (size_t *values_num,
return (RET_UNKNOWN);
}
return (RET_UNKNOWN);
}
- for (i = 0; i < match_ds_num_g; i++)
+ for (
size_t
i = 0; i < match_ds_num_g; i++)
{
size_t j;
{
size_t j;
@@
-182,7
+180,7
@@
static int filter_ds (size_t *values_num,
}
free (*values);
}
free (*values);
- for (i = 0; i < *values_num; i++)
+ for (
size_t
i = 0; i < *values_num; i++)
free ((*values_names)[i]);
free (*values_names);
free ((*values_names)[i]);
free (*values_names);
@@
-283,7
+281,6
@@
static int do_listval (lcc_connection_t *connection)
char *hostname = NULL;
int status;
char *hostname = NULL;
int status;
- size_t i;
status = lcc_listval (connection, &ret_ident, &ret_ident_num);
if (status != 0) {
status = lcc_listval (connection, &ret_ident, &ret_ident_num);
if (status != 0) {
@@
-301,7
+298,7
@@
static int do_listval (lcc_connection_t *connection)
return (RET_UNKNOWN);
}
return (RET_UNKNOWN);
}
- for (i = 0; i < ret_ident_num; ++i) {
+ for (
size_t
i = 0; i < ret_ident_num; ++i) {
char id[1024];
if ((hostname_g != NULL) && (strcasecmp (hostname_g, ret_ident[i].host)))
char id[1024];
if ((hostname_g != NULL) && (strcasecmp (hostname_g, ret_ident[i].host)))
@@
-345,9
+342,8
@@
static int do_check_con_none (size_t values_num,
int num_okay = 0;
const char *status_str = "UNKNOWN";
int status_code = RET_UNKNOWN;
int num_okay = 0;
const char *status_str = "UNKNOWN";
int status_code = RET_UNKNOWN;
- size_t i;
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
{
if (isnan (values[i]))
{
{
if (isnan (values[i]))
{
@@
-390,7
+386,7
@@
static int do_check_con_none (size_t values_num,
if (values_num > 0)
{
printf (" |");
if (values_num > 0)
{
printf (" |");
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
printf (" %s=%f;;;;", values_names[i], values[i]);
}
printf ("\n");
printf (" %s=%f;;;;", values_names[i], values[i]);
}
printf ("\n");
@@
-401,7
+397,6
@@
static int do_check_con_none (size_t values_num,
static int do_check_con_average (size_t values_num,
double *values, char **values_names)
{
static int do_check_con_average (size_t values_num,
double *values, char **values_names)
{
- size_t i;
double total;
int total_num;
double average;
double total;
int total_num;
double average;
@@
-410,7
+405,7
@@
static int do_check_con_average (size_t values_num,
total = 0.0;
total_num = 0;
total = 0.0;
total_num = 0;
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
{
if (isnan (values[i]))
{
{
if (isnan (values[i]))
{
@@
-451,7
+446,7
@@
static int do_check_con_average (size_t values_num,
}
printf ("%s: %g average |", status_str, average);
}
printf ("%s: %g average |", status_str, average);
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
printf (" %s=%f;;;;", values_names[i], values[i]);
printf ("\n");
printf (" %s=%f;;;;", values_names[i], values[i]);
printf ("\n");
@@
-461,7
+456,6
@@
static int do_check_con_average (size_t values_num,
static int do_check_con_sum (size_t values_num,
double *values, char **values_names)
{
static int do_check_con_sum (size_t values_num,
double *values, char **values_names)
{
- size_t i;
double total;
int total_num;
const char *status_str = "UNKNOWN";
double total;
int total_num;
const char *status_str = "UNKNOWN";
@@
-469,7
+463,7
@@
static int do_check_con_sum (size_t values_num,
total = 0.0;
total_num = 0;
total = 0.0;
total_num = 0;
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
{
if (isnan (values[i]))
{
{
if (isnan (values[i]))
{
@@
-508,7
+502,7
@@
static int do_check_con_sum (size_t values_num,
}
printf ("%s: %g sum |", status_str, total);
}
printf ("%s: %g sum |", status_str, total);
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
printf (" %s=%f;;;;", values_names[i], values[i]);
printf ("\n");
printf (" %s=%f;;;;", values_names[i], values[i]);
printf ("\n");
@@
-518,7
+512,6
@@
static int do_check_con_sum (size_t values_num,
static int do_check_con_percentage (size_t values_num,
double *values, char **values_names)
{
static int do_check_con_percentage (size_t values_num,
double *values, char **values_names)
{
- size_t i;
double sum = 0.0;
double percentage;
double sum = 0.0;
double percentage;
@@
-531,7
+524,7
@@
static int do_check_con_percentage (size_t values_num,
return (RET_WARNING);
}
return (RET_WARNING);
}
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
{
if (isnan (values[i]))
{
{
if (isnan (values[i]))
{
@@
-571,7
+564,7
@@
static int do_check_con_percentage (size_t values_num,
}
printf ("%s: %lf percent |", status_str, percentage);
}
printf ("%s: %lf percent |", status_str, percentage);
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
printf (" %s=%lf;;;;", values_names[i], values[i]);
return (status_code);
} /* int do_check_con_percentage */
printf (" %s=%lf;;;;", values_names[i], values[i]);
return (status_code);
} /* int do_check_con_percentage */
@@
-583,7
+576,6
@@
static int do_check (lcc_connection_t *connection)
size_t values_num;
char ident_str[1024];
lcc_identifier_t ident;
size_t values_num;
char ident_str[1024];
lcc_identifier_t ident;
- size_t i;
int status;
snprintf (ident_str, sizeof (ident_str), "%s/%s",
int status;
snprintf (ident_str, sizeof (ident_str), "%s/%s",
@@
-627,7
+619,7
@@
static int do_check (lcc_connection_t *connection)
free (values);
if (values_names != NULL)
free (values);
if (values_names != NULL)
- for (i = 0; i < values_num; i++)
+ for (
size_t
i = 0; i < values_num; i++)
free (values_names[i]);
free (values_names);
free (values_names[i]);
free (values_names);