Skip to content

Commit 02b248c

Browse files
committed
(Menu drivers) Don't call string_to_unsigned twice needlessly
1 parent 1dcd874 commit 02b248c

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

menu/drivers/materialui.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,7 +2496,8 @@ static void materialui_update_savestate_thumbnail_path(void *data, unsigned i)
24962496

24972497
if (!string_is_empty(entry.label))
24982498
{
2499-
if ( string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT
2499+
unsigned _state_slot = string_to_unsigned(entry.label);
2500+
if ( _state_slot == MENU_ENUM_LABEL_STATE_SLOT
25002501
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_STR)
25012502
|| string_is_equal(entry.label, MENU_ENUM_LABEL_LOAD_STATE_STR)
25022503
|| string_is_equal(entry.label, MENU_ENUM_LABEL_SAVE_STATE_STR))
@@ -2506,7 +2507,7 @@ static void materialui_update_savestate_thumbnail_path(void *data, unsigned i)
25062507
int state_slot = settings->ints.state_slot;
25072508

25082509
/* State slot dropdown */
2509-
if (string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT)
2510+
if (_state_slot == MENU_ENUM_LABEL_STATE_SLOT)
25102511
state_slot = i - 1;
25112512

25122513
gfx_savestate_thumbnail_get_path(path, sizeof(path),
@@ -5863,7 +5864,6 @@ static bool materialui_is_savestate_slot(materialui_handle_t *mui)
58635864
MENU_ENTRY_INITIALIZE(entry);
58645865
entry.flags |= MENU_ENTRY_FLAG_LABEL_ENABLED;
58655866
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
5866-
58675867
return string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT;
58685868
}
58695869

menu/drivers/rgui.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6986,7 +6986,8 @@ static void rgui_update_savestate_thumbnail_path(void *data, unsigned i)
69866986

69876987
if (!string_is_empty(entry.label))
69886988
{
6989-
if ( string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT
6989+
unsigned _state_slot = string_to_unsigned(entry.label);
6990+
if ( _state_slot == MENU_ENUM_LABEL_STATE_SLOT
69906991
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_STR)
69916992
|| string_is_equal(entry.label, MENU_ENUM_LABEL_LOAD_STATE_STR)
69926993
|| string_is_equal(entry.label, MENU_ENUM_LABEL_SAVE_STATE_STR))
@@ -6996,7 +6997,7 @@ static void rgui_update_savestate_thumbnail_path(void *data, unsigned i)
69966997
int state_slot = settings->ints.state_slot;
69976998

69986999
/* State slot dropdown */
6999-
if (string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT)
7000+
if (_state_slot == MENU_ENUM_LABEL_STATE_SLOT)
70007001
{
70017002
state_slot = i - 1;
70027003
rgui->flags |= RGUI_FLAG_IS_STATE_SLOT;

menu/drivers/xmb.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,8 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
13111311

13121312
if (!string_is_empty(entry.label))
13131313
{
1314-
if ( string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT
1314+
unsigned _state_slot = string_to_unsigned(entry.label);
1315+
if ( _state_slot == MENU_ENUM_LABEL_STATE_SLOT
13151316
|| string_is_equal(entry.label, MENU_ENUM_LABEL_STATE_SLOT_STR)
13161317
|| string_is_equal(entry.label, MENU_ENUM_LABEL_LOAD_STATE_STR)
13171318
|| string_is_equal(entry.label, MENU_ENUM_LABEL_SAVE_STATE_STR))
@@ -1321,7 +1322,7 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
13211322
int state_slot = settings->ints.state_slot;
13221323

13231324
/* State slot dropdown */
1324-
if (string_to_unsigned(entry.label) == MENU_ENUM_LABEL_STATE_SLOT)
1325+
if (_state_slot == MENU_ENUM_LABEL_STATE_SLOT)
13251326
{
13261327
state_slot = i - 1;
13271328
xmb->is_state_slot = true;

0 commit comments

Comments
 (0)