From 6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Wed, 30 Nov 2022 15:17:54 +0000 Subject: Remove browse_context_init() Prefer to use designated initializers to avoid having to specify unneeded parameters. Non-initialized members are zero-initialized by the compiler. Change-Id: Ia6a03c45cb3ef0b30f458d7d0ae1604a350c737c --- apps/plugins/open_plugins.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'apps/plugins/open_plugins.c') diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index 6deaf80f7d..9a2fa3593f 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c @@ -189,17 +189,20 @@ static void op_entry_set_name(void) static int op_entry_set_path(void) { int ret = 0; - struct browse_context browse; char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; if (op_entry.path[0] == '\0') rb->strcpy(op_entry.path, PLUGIN_DIR"/"); - rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, rb->str(LANG_ADD), - Icon_Plugin, op_entry.path, NULL); - - browse.buf = tmp_buf; - browse.bufsize = OPEN_PLUGIN_BUFSZ; + struct browse_context browse = { + .dirfilter = SHOW_ALL, + .flags = BROWSE_SELECTONLY, + .title = rb->str(LANG_ADD), + .icon = Icon_Plugin, + .root = op_entry.path, + .buf = tmp_buf, + .bufsize = sizeof(tmp_buf), + }; if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) { @@ -213,7 +216,6 @@ static int op_entry_set_path(void) static int op_entry_set_param_path(void) { int ret = 0; - struct browse_context browse; char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; if (op_entry.param[0] == '\0') @@ -221,11 +223,15 @@ static int op_entry_set_param_path(void) else rb->strcpy(tmp_buf, op_entry.param); - rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "", - Icon_Plugin, tmp_buf, NULL); - - browse.buf = tmp_buf; - browse.bufsize = OPEN_PLUGIN_BUFSZ; + struct browse_context browse = { + .dirfilter = SHOW_ALL, + .flags = BROWSE_SELECTONLY, + .title = rb->str(LANG_PARAMETER), + .icon = Icon_Plugin, + .root = tmp_buf, + .buf = tmp_buf, + .bufsize = sizeof(tmp_buf), + }; if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) { -- cgit v1.2.3