diff options
author | Aaron Marcher <me@drkhsh.at> | 2018-05-19 01:49:46 +0200 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-05-19 01:49:46 +0200 |
commit | aac29e2bba1d34762971718c40004f37415d411e (patch) | |
tree | 7f8754327a660b1588445a18f0ddca510df1c717 /components | |
parent | 22175f0d5792f1d046b6b501c694a3afabc877ed (diff) |
battery: Move out struct as common code
Diffstat (limited to 'components')
-rw-r--r-- | components/battery.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/components/battery.c b/components/battery.c index 3965e8f..b086a28 100644 --- a/components/battery.c +++ b/components/battery.c @@ -5,6 +5,14 @@ #include "../util.h" +static struct { + char *state; + char *symbol; +} map[] = { + { "Charging", "+" }, + { "Discharging", "-" }, +}; + #if defined(__linux__) #include <limits.h> @@ -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]; @@ -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++) { |