diff options
| author | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-21 00:03:15 +0000 |
|---|---|---|
| committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-06-21 00:03:15 +0000 |
| commit | a2ab719d57c2da0a66ece6d6ab1e2eb2a9192413 (patch) | |
| tree | 66145a3c22f86f2f97bc8c8a7ff7cc8fa4965e08 /apps/debug_menu.c | |
| parent | 41167f0e7b610d82e656e25feca8598361d65a44 (diff) | |
| download | rockbox-a2ab719d57c2da0a66ece6d6ab1e2eb2a9192413.zip rockbox-a2ab719d57c2da0a66ece6d6ab1e2eb2a9192413.tar.gz rockbox-a2ab719d57c2da0a66ece6d6ab1e2eb2a9192413.tar.bz2 rockbox-a2ab719d57c2da0a66ece6d6ab1e2eb2a9192413.tar.xz | |
debug menu: avoid using constant variables in array initialization
gcc fails to consider indexes as constant when building with -O0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27002 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
| -rw-r--r-- | apps/debug_menu.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 9b4ba51..8da0224 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1670,20 +1670,19 @@ static bool view_battery(void) #elif defined(SANSA_E200) || defined(SANSA_C200) || CONFIG_CPU == AS3525 || \ CONFIG_CPU == AS3525v2 - const int first = CHARGE_STATE_DISABLED; static const char * const chrgstate_strings[] = { - [CHARGE_STATE_DISABLED-first] = "Disabled", - [CHARGE_STATE_ERROR-first] = "Error", - [DISCHARGING-first] = "Discharging", - [CHARGING-first] = "Charging", + [CHARGE_STATE_DISABLED - CHARGE_STATE_DISABLED]= "Disabled", + [CHARGE_STATE_ERROR - CHARGE_STATE_DISABLED] = "Error", + [DISCHARGING - CHARGE_STATE_DISABLED] = "Discharging", + [CHARGING - CHARGE_STATE_DISABLED] = "Charging", }; const char *str = NULL; lcd_putsf(0, 3, "Charger: %s", charger_inserted() ? "present" : "absent"); - y = charge_state - first; + y = charge_state - CHARGE_STATE_DISABLED; if ((unsigned)y < ARRAYLEN(chrgstate_strings)) str = chrgstate_strings[y]; |