Xinqi Bao's Git

Revert aac29e2 as it is nonsense
[slstatus.git] / components / battery.c
index 3965e8f..90e8590 100644 (file)
@@ -22,7 +22,7 @@
        const char *
        battery_state(const char *bat)
        {
-               struct {
+               static struct {
                        char *state;
                        char *symbol;
                } map[] = {
        const char *
        battery_state(const char *unused)
        {
-               struct apm_power_info apm_info;
-               size_t i;
                struct {
                        unsigned int state;
                        char *symbol;
                        { APM_AC_ON,      "+" },
                        { APM_AC_OFF,     "-" },
                };
+               struct apm_power_info apm_info;
+               size_t i;
 
                if (load_apm_power_info(&apm_info)) {
                        for (i = 0; i < LEN(map); i++) {