action_select_default optimization

This commit is contained in:
twinaphex 2020-06-07 03:33:24 +02:00
parent b2124a1f89
commit 0010bffb63

View File

@ -34,24 +34,15 @@
#define BIND_ACTION_SELECT(cbs, name) (cbs)->action_select = (name)
#endif
static int action_select_default(const char *path, const char *label, unsigned type,
static int action_select_default(
const char *path, const char *label, unsigned type,
size_t idx, size_t entry_idx)
{
menu_entry_t entry;
int ret = 0;
enum menu_action action = MENU_ACTION_NOOP;
menu_file_list_cbs_t *cbs = NULL;
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
menu_entry_init(&entry);
/* Note: If menu_entry_action() is modified,
* will have to verify that these parameters
* remain unused... */
entry.rich_label_enabled = false;
entry.value_enabled = false;
entry.sublabel_enabled = false;
menu_entry_get(&entry, 0, idx, NULL, false);
if (selection_buf)
cbs = (menu_file_list_cbs_t*)
file_list_get_actiondata_at_offset(selection_buf, idx);
@ -101,7 +92,20 @@ static int action_select_default(const char *path, const char *label, unsigned t
}
if (action != MENU_ACTION_NOOP)
ret = menu_entry_action(&entry, idx, action);
{
menu_entry_t entry;
menu_entry_init(&entry);
/* Note: If menu_entry_action() is modified,
* will have to verify that these parameters
* remain unused... */
entry.rich_label_enabled = false;
entry.value_enabled = false;
entry.sublabel_enabled = false;
menu_entry_get(&entry, 0, idx, NULL, false);
ret = menu_entry_action(&entry, idx, action);
}
task_queue_check();