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
/
swap.c
diff --git
a/src/swap.c
b/src/swap.c
index
d714b5f
..
15eca9a
100644
(file)
--- a/
src/swap.c
+++ b/
src/swap.c
@@
-35,6
+35,7
@@
#endif
#include "collectd.h"
#endif
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
@@
-112,9
+113,7
@@
static _Bool values_percentage = 0;
static int swap_config (oconfig_item_t *ci) /* {{{ */
{
static int swap_config (oconfig_item_t *ci) /* {{{ */
{
- int i;
-
- for (i = 0; i < ci->children_num; i++)
+ for (int i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("ReportBytes", child->key) == 0)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("ReportBytes", child->key) == 0)
@@
-509,7
+508,6
@@
static int swap_read (void) /* {{{ */
char *s_paths;
int swap_num;
int status;
char *s_paths;
int swap_num;
int status;
- int i;
gauge_t avail = 0;
gauge_t total = 0;
gauge_t avail = 0;
gauge_t total = 0;
@@
-542,7
+540,7
@@
static int swap_read (void) /* {{{ */
sfree (s);
return (-1);
}
sfree (s);
return (-1);
}
- for (i = 0; i < swap_num; i++)
+ for (i
nt i
= 0; i < swap_num; i++)
s->swt_ent[i].ste_path = s_paths + (i * PATH_MAX);
s->swt_n = swap_num;
s->swt_ent[i].ste_path = s_paths + (i * PATH_MAX);
s->swt_n = swap_num;
@@
-572,7
+570,7
@@
static int swap_read (void) /* {{{ */
/* less elements returned than requested */
swap_num = status;
/* less elements returned than requested */
swap_num = status;
- for (i = 0; i < swap_num; i++)
+ for (i
nt i
= 0; i < swap_num; i++)
{
char path[PATH_MAX];
gauge_t this_total;
{
char path[PATH_MAX];
gauge_t this_total;
@@
-625,7
+623,6
@@
static int swap_read (void) /* {{{ */
struct swapent *swap_entries;
int swap_num;
int status;
struct swapent *swap_entries;
int swap_num;
int status;
- int i;
gauge_t used = 0;
gauge_t total = 0;
gauge_t used = 0;
gauge_t total = 0;
@@
-664,7
+661,7
@@
static int swap_read (void) /* {{{ */
/* TODO: Report per-device stats. The path name is available from
* swap_entries[i].se_path */
/* TODO: Report per-device stats. The path name is available from
* swap_entries[i].se_path */
- for (i = 0; i < swap_num; i++)
+ for (i
nt i
= 0; i < swap_num; i++)
{
if ((swap_entries[i].se_flags & SWF_ENABLE) == 0)
continue;
{
if ((swap_entries[i].se_flags & SWF_ENABLE) == 0)
continue;
@@
-761,14
+758,13
@@
static int swap_read (void) /* {{{ */
#elif HAVE_PERFSTAT
static int swap_read (void) /* {{{ */
{
#elif HAVE_PERFSTAT
static int swap_read (void) /* {{{ */
{
- perfstat_memory_total_t pmemory;
+ perfstat_memory_total_t pmemory
= { 0 }
;
int status;
gauge_t total;
gauge_t free;
gauge_t reserved;
int status;
gauge_t total;
gauge_t free;
gauge_t reserved;
- memset (&pmemory, 0, sizeof (pmemory));
status = perfstat_memory_total (NULL, &pmemory, sizeof(perfstat_memory_total_t), 1);
if (status < 0)
{
status = perfstat_memory_total (NULL, &pmemory, sizeof(perfstat_memory_total_t), 1);
if (status < 0)
{