X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbattery.c;h=0350a9eb1dae3b84bffdf84b6ebf2b33a27e48ed;hb=50345eec33951b964e2829e83c30399b71f2baba;hp=9b060dd9286cc692f03cd8205121868fe0f786ae;hpb=979b0fa58b2de639ff79209eff12ec17ff593483;p=collectd.git diff --git a/src/battery.c b/src/battery.c index 9b060dd9..0350a9eb 100644 --- a/src/battery.c +++ b/src/battery.c @@ -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); } @@ -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);