summaryrefslogtreecommitdiffstats
path: root/apps/filetree.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-10-20 16:05:21 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2021-10-20 16:05:21 -0400
commit9878226e4dec1ee7bb1434249214d6d8161b439f (patch)
tree6946582892b0e4f62c8072a546e95fb2a6a19977 /apps/filetree.c
parente1553d860dc42a819fe71913d5a68a77fbf64a6e (diff)
downloadrockbox-9878226e4dec1ee7bb1434249214d6d8161b439f.tar.gz
rockbox-9878226e4dec1ee7bb1434249214d6d8161b439f.zip
filetree.c move static and stack allocated buffers around
it makes more sense to make the main buffer static and make the second (infrequently needed) buffer as stack allocated Change-Id: Ide7c1a7a312124e47a23ed0ab75a90d7b8be982e
Diffstat (limited to 'apps/filetree.c')
-rw-r--r--apps/filetree.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 5c6443cc34..66e4a68398 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -435,7 +435,8 @@ static void ft_load_font(char *file)
int ft_enter(struct tree_context* c)
{
int rc = GO_TO_PREVIOUS;
- char buf[MAX_PATH];
+ static char buf[MAX_PATH];
+
struct entry* file = tree_get_entry_at(c, c->selected_item);
if (!file)
{
@@ -634,17 +635,18 @@ int ft_enter(struct tree_context* c)
case FILE_ATTR_LUA:
case FILE_ATTR_OPX:
{
- char *plugin = buf, *argument = NULL, lua_path[MAX_PATH];
+ char *plugin = buf, *argument = NULL;
+ char plugin_path[MAX_PATH];
int ret;
if ((file_attr & FILE_ATTR_MASK) == FILE_ATTR_LUA) {
- snprintf(lua_path, sizeof(lua_path)-1, "%s/lua.rock", VIEWERS_DIR); /* Use a #define here ? */
- plugin = lua_path;
+ snprintf(plugin_path, sizeof(plugin_path)-1, "%s/lua.rock", VIEWERS_DIR); /* Use a #define here ? */
+ plugin = plugin_path;
argument = buf;
}
else if ((file_attr & FILE_ATTR_MASK) == FILE_ATTR_OPX) {
- snprintf(lua_path, sizeof(lua_path)-1, "%s/open_plugins.rock", VIEWERS_DIR); /* Use a #define here ? */
- plugin = lua_path;
+ snprintf(plugin_path, sizeof(plugin_path)-1, "%s/open_plugins.rock", VIEWERS_DIR); /* Use a #define here ? */
+ plugin = plugin_path;
argument = buf;
}
@@ -685,7 +687,8 @@ int ft_enter(struct tree_context* c)
default:
{
const char* plugin;
-
+ char plugin_path[MAX_PATH];
+ const char *argument = buf;
if (global_settings.party_mode && audio_status()) {
splash(HZ, ID2P(LANG_PARTY_MODE));
break;
@@ -698,10 +701,10 @@ int ft_enter(struct tree_context* c)
return rc;
}
- plugin = filetype_get_plugin(file);
+ plugin = filetype_get_plugin(file, plugin_path, sizeof(plugin_path));
if (plugin)
{
- switch (plugin_load(plugin,buf))
+ switch (plugin_load(plugin, argument))
{
case PLUGIN_USB_CONNECTED:
rc = GO_TO_FILEBROWSER;