Skip to content

Commit

Permalink
ui/menu.c: Replace "if + strcpy" with conditional argument.
Browse files Browse the repository at this point in the history
This saves a few bytes of flash.
  • Loading branch information
wutje committed Dec 29, 2023
1 parent 36ee310 commit 9042ebc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,7 @@ void UI_DisplayMenu(void)
if (!gIsInSubMenu || edit_index < 0)
{ // show the channel name
SETTINGS_FetchChannelName(String, gSubMenuSelection);
char *pPrintStr = String[0] ? String : "--";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(String[0] ? String : "--", menu_item_x1, menu_item_x2, 2, 8);
}
else
{ // show the channel name being edited
Expand Down Expand Up @@ -935,8 +934,7 @@ void UI_DisplayMenu(void)
{ // display the channel name
char s[11];
SETTINGS_FetchChannelName(s, gSubMenuSelection);
char *pPrintStr = s[0] ? s : "--";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 2, 8);
UI_PrintString(s[0] ? s : "--", menu_item_x1, menu_item_x2, 2, 8);
}

if ((UI_MENU_GetCurrentMenuId() == MENU_R_CTCS || UI_MENU_GetCurrentMenuId() == MENU_R_DCS) && gCssBackgroundScan)
Expand Down Expand Up @@ -968,8 +966,7 @@ void UI_DisplayMenu(void)
UI_MENU_GetCurrentMenuId() == MENU_MEM_NAME ||
UI_MENU_GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
{ // display confirmation
char *pPrintStr = (gAskForConfirmation == 1) ? "SURE?" : "WAIT!";
UI_PrintString(pPrintStr, menu_item_x1, menu_item_x2, 5, 8);
UI_PrintString((gAskForConfirmation == 1) ? "SURE?" : "WAIT!", menu_item_x1, menu_item_x2, 5, 8);
}

ST7565_BlitFullScreen();
Expand Down

0 comments on commit 9042ebc

Please sign in to comment.