src/Makefile: Move proto-generated sources to nodist_*_SOURCES.
[collectd.git] / src / battery.c
index 9b060dd..8a96e89 100644 (file)
@@ -143,7 +143,7 @@ static void submit_capacity (char const *plugin_instance, /* {{{ */
 } /* }}} void submit_capacity */
 
 #if HAVE_IOKIT_PS_IOPOWERSOURCES_H || HAVE_IOKIT_IOKITLIB_H
-static double dict_get_double (CFDictionaryRef dict, char *key_string) /* {{{ */
+static double dict_get_double (CFDictionaryRef dict, const char *key_string) /* {{{ */
 {
        double      val_double;
        long long   val_int;
@@ -341,7 +341,7 @@ static void get_via_generic_iokit (double *ret_capacity_full, /* {{{ */
                                *ret_voltage = temp_double / 1000.0;
                        }
                }
-               
+
                CFRelease (bat_root_dict);
        }
 
@@ -358,7 +358,7 @@ static int battery_read (void) /* {{{ */
         * IOPowerSources. IOKit, on the other hand, only reports the full
         * capacity. We use the two to calculate the current charged capacity. */
        gauge_t charge_rel = NAN; /* Current charge in percent */
-       gauge_t capacity_charged = NAN; /* Charged capacity */
+       gauge_t capacity_charged; /* Charged capacity */
        gauge_t capacity_full = NAN; /* Total capacity */
        gauge_t capacity_design = NAN; /* Full design capacity */
 
@@ -556,7 +556,7 @@ static int read_acpi_full_capacity (char const *dir, /* {{{ */
 
        ssnprintf (filename, sizeof (filename), "%s/%s/info", dir, power_supply);
        fh = fopen (filename, "r");
-       if ((fh = fopen (filename, "r")) == NULL)
+       if (fh == NULL)
                return (errno);
 
        /* last full capacity:      40090 mWh */
@@ -615,7 +615,7 @@ static int read_acpi_callback (char const *dir, /* {{{ */
 
        ssnprintf (filename, sizeof (filename), "%s/%s/state", dir, power_supply);
        fh = fopen (filename, "r");
-       if ((fh = fopen (filename, "r")) == NULL)
+       if (fh == NULL)
        {
                if ((errno == EAGAIN) || (errno == EINTR) || (errno == ENOENT))
                        return (0);