X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fbattery.c;h=a74e7b6423dc6f6692e496ee3d987ef85f285715;hp=0e2667c95ef66bc099d7b9b9afaf067fafa0cd46;hb=6e41c3b1f024d7944e5e8010a87933555c662474;hpb=029b489b237a8785c539f85d4840a49ba6743603 diff --git a/src/battery.c b/src/battery.c index 0e2667c9..a74e7b64 100644 --- a/src/battery.c +++ b/src/battery.c @@ -410,7 +410,7 @@ static int read_sysfs_callback(char const *dir, /* {{{ */ char const *plugin_instance; char buffer[32]; gauge_t v = NAN; - bool discharging = 0; + bool discharging = false; int status; /* Ignore non-battery directories, such as AC power. */ @@ -424,7 +424,7 @@ static int read_sysfs_callback(char const *dir, /* {{{ */ (void)sysfs_file_to_buffer(dir, power_supply, "status", buffer, sizeof(buffer)); if (strcasecmp("Discharging", buffer) == 0) - discharging = 1; + discharging = true; /* FIXME: This is a dirty hack for backwards compatibility: The battery * plugin, for a very long time, has had the plugin_instance @@ -522,8 +522,8 @@ static int read_acpi_callback(char const *dir, /* {{{ */ gauge_t capacity_charged = NAN; gauge_t capacity_full = NAN; gauge_t capacity_design = NAN; - bool charging = 0; - bool is_current = 0; + bool charging = false; + bool is_current = false; char const *plugin_instance; char filename[PATH_MAX]; @@ -560,9 +560,9 @@ static int read_acpi_callback(char const *dir, /* {{{ */ if ((strcmp(fields[0], "charging") == 0) && (strcmp(fields[1], "state:") == 0)) { if (strcmp(fields[2], "charging") == 0) - charging = 1; + charging = true; else - charging = 0; + charging = false; continue; } @@ -575,7 +575,7 @@ static int read_acpi_callback(char const *dir, /* {{{ */ strtogauge(fields[2], &power); if ((numfields >= 4) && (strcmp("mA", fields[3]) == 0)) - is_current = 1; + is_current = true; } else if ((strcmp(fields[0], "remaining") == 0) && (strcmp(fields[1], "capacity:") == 0)) strtogauge(fields[2], &capacity_charged);