From 127af53c5b2a8b8672b6c8ad089d4d08d6fc5816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Wed, 4 Jan 2012 07:42:03 +0000 Subject: [PATCH] debug_menu.c: cleanup use c99 for() cosmetics remove the_menu_item struct -> merge with only use merge variables declaration/assignement git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31575 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 92 ++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 61 deletions(-) diff --git a/apps/debug_menu.c b/apps/debug_menu.c index cc76d24d18..0435f322de 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1531,7 +1531,6 @@ static int disk_callback(int btn, struct gui_synclist *lists) #else /* No SD, MMC or ATA */ static int disk_callback(int btn, struct gui_synclist *lists) { - (void)btn; (void)lists; struct storage_info info; storage_get_info(0,&info); @@ -1587,7 +1586,7 @@ static bool dbg_disk_info(void) #ifdef HAVE_DIRCACHE static int dircache_callback(int btn, struct gui_synclist *lists) { - (void)btn; (void)lists; + (void)lists; simplelist_set_line_count(0); simplelist_addline(SIMPLELIST_ADD_LINE, "Cache initialized: %s", dircache_is_enabled() ? "Yes" : "No"); @@ -1756,9 +1755,7 @@ static bool dbg_save_roms(void) #elif defined(CPU_PP) && !(CONFIG_STORAGE & STORAGE_SD) static bool dbg_save_roms(void) { - int fd; - - fd = creat("/internal_rom_000000-0FFFFF.bin", 0666); + int fd = creat("/internal_rom_000000-0FFFFF.bin", 0666); if(fd >= 0) { write(fd, (void *)0x20000000, FLASH_SIZE); @@ -1770,9 +1767,7 @@ static bool dbg_save_roms(void) #elif CONFIG_CPU == IMX31L static bool dbg_save_roms(void) { - int fd; - - fd = creat("/flash_rom_A0000000-A01FFFFF.bin", 0666); + int fd = creat("/flash_rom_A0000000-A01FFFFF.bin", 0666); if (fd >= 0) { write(fd, (void*)0xa0000000, FLASH_SIZE); @@ -1784,9 +1779,7 @@ static bool dbg_save_roms(void) #elif defined(CPU_TCC780X) static bool dbg_save_roms(void) { - int fd; - - fd = creat("/eeprom_E0000000-E0001FFF.bin", 0666); + int fd = creat("/eeprom_E0000000-E0001FFF.bin", 0666); if (fd >= 0) { write(fd, (void*)0xe0000000, 0x2000); @@ -1854,10 +1847,9 @@ static int radio_callback(int btn, struct gui_synclist *lists) IF_TUNER_TYPE(SI4700) { struct si4700_dbg_info nfo; - int i; si4700_dbg_info(&nfo); simplelist_addline(SIMPLELIST_ADD_LINE, "SI4700 regs:"); - for (i = 0; i < 16; i += 4) { + for (int i = 0; i < 16; i += 4) { simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X", i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); } @@ -1876,10 +1868,9 @@ static int radio_callback(int btn, struct gui_synclist *lists) IF_TUNER_TYPE(RDA5802) { struct rda5802_dbg_info nfo; - int i; rda5802_dbg_info(&nfo); simplelist_addline(SIMPLELIST_ADD_LINE, "RDA5802 regs:"); - for (i = 0; i < 16; i += 4) { + for (int i = 0; i < 16; i += 4) { simplelist_addline(SIMPLELIST_ADD_LINE,"%02X: %04X %04X %04X %04X", i, nfo.regs[i], nfo.regs[i+1], nfo.regs[i+2], nfo.regs[i+3]); } @@ -1912,8 +1903,7 @@ extern bool do_screendump_instead_of_usb; static bool dbg_screendump(void) { do_screendump_instead_of_usb = !do_screendump_instead_of_usb; - splashf(HZ, "Screendump %s", - do_screendump_instead_of_usb?"enabled":"disabled"); + splashf(HZ, "Screendump %sabled", do_screendump_instead_of_usb?"en":"dis"); return false; } #endif /* HAVE_LCD_BITMAP */ @@ -1923,8 +1913,7 @@ extern bool write_metadata_log; static bool dbg_metadatalog(void) { write_metadata_log = !write_metadata_log; - splashf(HZ, "Metadata log %s", - write_metadata_log?"enabled":"disabled"); + splashf(HZ, "Metadata log %sabled", write_metadata_log ? "en" : "dis"); return false; } @@ -1948,23 +1937,18 @@ static bool dbg_set_memory_guard(void) #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) static bool dbg_write_eeprom(void) { - int fd; - int rc; - int old_irq_level; - char buf[EEPROM_SIZE]; - int err; - - fd = open("/internal_eeprom.bin", O_RDONLY); + int fd = open("/internal_eeprom.bin", O_RDONLY); if (fd >= 0) { - rc = read(fd, buf, EEPROM_SIZE); + char buf[EEPROM_SIZE]; + int rc = read(fd, buf, EEPROM_SIZE); if(rc == EEPROM_SIZE) { - old_irq_level = disable_irq_save(); + int old_irq_level = disable_irq_save(); - err = eeprom_24cxx_write(0, buf, sizeof buf); + int err = eeprom_24cxx_write(0, buf, sizeof buf); if (err) splashf(HZ*3, "Eeprom write failure (%d)", err); else @@ -1989,17 +1973,14 @@ static bool dbg_write_eeprom(void) #ifdef CPU_BOOST_LOGGING static bool cpu_boost_log(void) { - int i = 0,j=0; int count = cpu_boost_log_getcount(); - int lines = LCD_HEIGHT/SYSFONT_HEIGHT; - char *str; + char *str = cpu_boost_log_getlog_first(); bool done; lcd_setfont(FONT_SYSFIXED); - str = cpu_boost_log_getlog_first(); - while (i < count) + for (int i = 0; i < count ;) { lcd_clear_display(); - for(j=0; j