[hackers] [slstatus] battery: Move out struct as common code || Aaron Marcher
commit aac29e2bba1d34762971718c40004f37415d411e
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Sat May 19 01:49:46 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Sat May 19 01:49:46 2018 +0200
battery: Move out struct as common code
diff --git a/components/battery.c b/components/battery.c
index 3965e8f..b086a28 100644
--- a/components/battery.c
+++ b/components/battery.c
_AT_@ -5,6 +5,14 @@
#include "../util.h"
+static struct {
+ char *state;
+ char *symbol;
+} map[] = {
+ { "Charging", "+" },
+ { "Discharging", "-" },
+};
+
#if defined(__linux__)
#include <limits.h>
_AT_@ -22,13 +30,6 @@
const char *
battery_state(const char *bat)
{
- struct {
- char *state;
- char *symbol;
- } map[] = {
- { "Charging", "+" },
- { "Discharging", "-" },
- };
size_t i;
char path[PATH_MAX], state[12];
_AT_@ -123,13 +124,6 @@
{
struct apm_power_info apm_info;
size_t i;
- struct {
- unsigned int state;
- char *symbol;
- } map[] = {
- { APM_AC_ON, "+" },
- { APM_AC_OFF, "-" },
- };
if (load_apm_power_info(&apm_info)) {
for (i = 0; i < LEN(map); i++) {
Received on Sat May 19 2018 - 01:57:11 CEST
This archive was generated by hypermail 2.3.0
: Sat May 19 2018 - 02:00:38 CEST