Random coding style fixes and simplifications (trivial).

This will even reduce the final payload size a bit.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3427 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Uwe Hermann 2008-07-18 14:08:18 +00:00
parent eafceddf6c
commit 941aaee885
2 changed files with 27 additions and 51 deletions

View File

@ -77,7 +77,6 @@ struct coreinfo_cat {
} }
}; };
static WINDOW *modwin; static WINDOW *modwin;
static WINDOW *menuwin; static WINDOW *menuwin;
@ -184,8 +183,6 @@ static void header(int row, const char *str)
ptr += sprintf(ptr, "[ %s ]", str); ptr += sprintf(ptr, "[ %s ]", str);
for (i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X; i++) for (i = ((SCREEN_X - len) / 2) + len; i < SCREEN_X; i++)
ptr += sprintf(ptr, "="); ptr += sprintf(ptr, "=");
@ -207,9 +204,7 @@ static void handle_category_key(struct coreinfo_cat *cat, int key)
{ {
if (key >= 'a' && key <= 'z') { if (key >= 'a' && key <= 'z') {
int index = key - 'a'; int index = key - 'a';
if (index < cat->count) { if (index < cat->count) {
cat->cur = index; cat->cur = index;
redraw_module(cat); redraw_module(cat);
return; return;

View File

@ -22,8 +22,9 @@
#ifdef CONFIG_MODULE_LAR #ifdef CONFIG_MODULE_LAR
static struct LAR *lar; static struct LAR *lar;
static int lcount; static int lcount, selected;
static char **lnames; static char **lnames;
static const char *compression_table[4] = {"none", "LZMA", "NRV2B", "zeroes"};
static int lar_module_init(void) static int lar_module_init(void)
{ {
@ -51,12 +52,9 @@ static int lar_module_init(void)
return 0; return 0;
} }
static int selected;
static int lar_module_redraw(WINDOW *win) static int lar_module_redraw(WINDOW *win)
{ {
int i; int i, row = 2;
int row = 2;
struct larstat stat; struct larstat stat;
print_module_title(win, "LAR Listing"); print_module_title(win, "LAR Listing");
@ -66,15 +64,11 @@ static int lar_module_redraw(WINDOW *win)
return 0; return 0;
} }
/* Draw a line down the middle */ /* Draw a line down the middle. */
for (i = 2; i < 21; i++)
for(i = 2; i < 20; i++) { mvwaddch(win, i, 30, '\263');
wmove(win, i, 30);
waddch(win, '\263');
}
/* Draw the names down the left side */
/* Draw the names down the left side. */
for (i = 0; i < lcount; i++) { for (i = 0; i < lcount; i++) {
if (i == selected) if (i == selected)
wattrset(win, COLOR_PAIR(3) | A_BOLD); wattrset(win, COLOR_PAIR(3) | A_BOLD);
@ -84,8 +78,7 @@ static int lar_module_redraw(WINDOW *win)
mvwprintw(win, 2 + i, 1, "%.25s", lnames[i]); mvwprintw(win, 2 + i, 1, "%.25s", lnames[i]);
} }
/* Get the information for the LAR */ /* Get the information for the LAR. */
if (larstat(lar, lnames[selected], &stat)) { if (larstat(lar, lnames[selected], &stat)) {
printf("larstat failed\n"); printf("larstat failed\n");
return 0; return 0;
@ -96,26 +89,17 @@ static int lar_module_redraw(WINDOW *win)
mvwprintw(win, row++, 32, "Offset: 0x%x", stat.offset); mvwprintw(win, row++, 32, "Offset: 0x%x", stat.offset);
if (stat.compression) { if (stat.compression) {
switch(stat.compression) { mvwprintw(win, row++, 32, "Compression: %s",
case ALGO_LZMA: compression_table[stat.compression]);
mvwprintw(win, row++, 32, "Compression: LZMA");
break;
case ALGO_NRV2B:
mvwprintw(win, row++, 32, "Compression: NRV2B");
break;
case ALGO_ZEROES:
mvwprintw(win, row++, 32, "Compression: zeroes");
break;
}
mvwprintw(win, row++, 32, "Compressed length: %d", stat.len); mvwprintw(win, row++, 32, "Compressed length: %d", stat.len);
mvwprintw(win, row++, 32, "Compressed checksum: 0x%x", stat.compchecksum); mvwprintw(win, row++, 32, "Compressed checksum: 0x%x",
stat.compchecksum);
} }
mvwprintw(win, row++, 32, "Length: %d", stat.reallen); mvwprintw(win, row++, 32, "Length: %d", stat.reallen);
mvwprintw(win, row++, 32, "Checksum: 0x%x", stat.checksum); mvwprintw(win, row++, 32, "Checksum: 0x%x", stat.checksum);
mvwprintw(win, row++, 32, "Load Address: 0x%llx", stat.loadaddress); mvwprintw(win, row++, 32, "Load address: 0x%llx", stat.loadaddress);
mvwprintw(win, row++, 32, "Entry Point: 0x%llx", stat.entry); mvwprintw(win, row++, 32, "Entry point: 0x%llx", stat.entry);
return 0; return 0;
} }
@ -151,13 +135,10 @@ struct coreinfo_module lar_module = {
.redraw = lar_module_redraw, .redraw = lar_module_redraw,
.handle = lar_module_handle .handle = lar_module_handle
}; };
#else #else
struct coreinfo_module lar_module = { struct coreinfo_module lar_module = {
}; };
#endif #endif