diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-30 15:17:54 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-17 13:36:38 +0000 |
commit | 6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9 (patch) | |
tree | 9d51172c8860a72e5081dc2706dd30f4dd295427 /apps/plugins/open_plugins.c | |
parent | 701e262d3d622898279167ba909da631ac460bc1 (diff) | |
download | rockbox-6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9.tar.gz rockbox-6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9.zip |
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
Diffstat (limited to 'apps/plugins/open_plugins.c')
-rw-r--r-- | apps/plugins/open_plugins.c | 30 |
1 files changed, 18 insertions, 12 deletions
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) | |||
189 | static int op_entry_set_path(void) | 189 | static int op_entry_set_path(void) |
190 | { | 190 | { |
191 | int ret = 0; | 191 | int ret = 0; |
192 | struct browse_context browse; | ||
193 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; | 192 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; |
194 | 193 | ||
195 | if (op_entry.path[0] == '\0') | 194 | if (op_entry.path[0] == '\0') |
196 | rb->strcpy(op_entry.path, PLUGIN_DIR"/"); | 195 | rb->strcpy(op_entry.path, PLUGIN_DIR"/"); |
197 | 196 | ||
198 | rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, rb->str(LANG_ADD), | 197 | struct browse_context browse = { |
199 | Icon_Plugin, op_entry.path, NULL); | 198 | .dirfilter = SHOW_ALL, |
200 | 199 | .flags = BROWSE_SELECTONLY, | |
201 | browse.buf = tmp_buf; | 200 | .title = rb->str(LANG_ADD), |
202 | browse.bufsize = OPEN_PLUGIN_BUFSZ; | 201 | .icon = Icon_Plugin, |
202 | .root = op_entry.path, | ||
203 | .buf = tmp_buf, | ||
204 | .bufsize = sizeof(tmp_buf), | ||
205 | }; | ||
203 | 206 | ||
204 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) | 207 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) |
205 | { | 208 | { |
@@ -213,7 +216,6 @@ static int op_entry_set_path(void) | |||
213 | static int op_entry_set_param_path(void) | 216 | static int op_entry_set_param_path(void) |
214 | { | 217 | { |
215 | int ret = 0; | 218 | int ret = 0; |
216 | struct browse_context browse; | ||
217 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; | 219 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; |
218 | 220 | ||
219 | if (op_entry.param[0] == '\0') | 221 | if (op_entry.param[0] == '\0') |
@@ -221,11 +223,15 @@ static int op_entry_set_param_path(void) | |||
221 | else | 223 | else |
222 | rb->strcpy(tmp_buf, op_entry.param); | 224 | rb->strcpy(tmp_buf, op_entry.param); |
223 | 225 | ||
224 | rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "", | 226 | struct browse_context browse = { |
225 | Icon_Plugin, tmp_buf, NULL); | 227 | .dirfilter = SHOW_ALL, |
226 | 228 | .flags = BROWSE_SELECTONLY, | |
227 | browse.buf = tmp_buf; | 229 | .title = rb->str(LANG_PARAMETER), |
228 | browse.bufsize = OPEN_PLUGIN_BUFSZ; | 230 | .icon = Icon_Plugin, |
231 | .root = tmp_buf, | ||
232 | .buf = tmp_buf, | ||
233 | .bufsize = sizeof(tmp_buf), | ||
234 | }; | ||
229 | 235 | ||
230 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) | 236 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) |
231 | { | 237 | { |