projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'github/pr/1883'
[collectd.git]
/
src
/
battery.c
diff --git
a/src/battery.c
b/src/battery.c
index
4e0c06f
..
a084319
100644
(file)
--- a/
src/battery.c
+++ b/
src/battery.c
@@
-24,6
+24,7
@@
**/
#include "collectd.h"
**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
#include "common.h"
#include "plugin.h"
@@
-201,7
+202,6
@@
static void get_via_io_power_sources (double *ret_charge, /* {{{ */
CFTypeRef ps_obj;
double temp_double;
CFTypeRef ps_obj;
double temp_double;
- int i;
ps_raw = IOPSCopyPowerSourcesInfo ();
ps_array = IOPSCopyPowerSourcesList (ps_raw);
ps_raw = IOPSCopyPowerSourcesInfo ();
ps_array = IOPSCopyPowerSourcesList (ps_raw);
@@
-209,7
+209,7
@@
static void get_via_io_power_sources (double *ret_charge, /* {{{ */
DEBUG ("ps_array_len == %i", ps_array_len);
DEBUG ("ps_array_len == %i", ps_array_len);
- for (i = 0; i < ps_array_len; i++)
+ for (i
nt i
= 0; i < ps_array_len; i++)
{
ps_obj = CFArrayGetValueAtIndex (ps_array, i);
ps_dict = IOPSGetPowerSourceDescription (ps_raw, ps_obj);
{
ps_obj = CFArrayGetValueAtIndex (ps_array, i);
ps_dict = IOPSGetPowerSourceDescription (ps_raw, ps_obj);
@@
-274,7
+274,6
@@
static void get_via_generic_iokit (double *ret_capacity_full, /* {{{ */
CFDictionaryRef bat_root_dict;
CFArrayRef bat_info_arry;
CFIndex bat_info_arry_len;
CFDictionaryRef bat_root_dict;
CFArrayRef bat_info_arry;
CFIndex bat_info_arry_len;
- CFIndex bat_info_arry_pos;
CFDictionaryRef bat_info_dict;
double temp_double;
CFDictionaryRef bat_info_dict;
double temp_double;
@@
-309,7
+308,7
@@
static void get_via_generic_iokit (double *ret_capacity_full, /* {{{ */
}
bat_info_arry_len = CFArrayGetCount (bat_info_arry);
}
bat_info_arry_len = CFArrayGetCount (bat_info_arry);
- for (bat_info_arry_pos = 0;
+ for (
CFIndex
bat_info_arry_pos = 0;
bat_info_arry_pos < bat_info_arry_len;
bat_info_arry_pos++)
{
bat_info_arry_pos < bat_info_arry_len;
bat_info_arry_pos++)
{
@@
-713,11
+712,10
@@
static int read_acpi (void) /* {{{ */
static int read_pmu (void) /* {{{ */
{
static int read_pmu (void) /* {{{ */
{
- int i;
-
+ int i = 0;
/* The upper limit here is just a safeguard. If there is a system with
* more than 100 batteries, this can easily be increased. */
/* The upper limit here is just a safeguard. If there is a system with
* more than 100 batteries, this can easily be increased. */
- for (
i = 0
; i < 100; i++)
+ for (; i < 100; i++)
{
FILE *fh;
{
FILE *fh;
@@
-802,9
+800,7
@@
static int battery_read (void) /* {{{ */
static int battery_config (oconfig_item_t *ci)
{
static int battery_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;
{
oconfig_item_t *child = ci->children + i;