summaryrefslogtreecommitdiffstats
path: root/apps/filetypes.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/filetypes.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/filetypes.c')
-rw-r--r--apps/filetypes.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 530ab18683..3724f57a9b 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -531,17 +531,16 @@ int filetype_get_icon(int attr)
return filetypes[index].icon;
}
-char* filetype_get_plugin(const struct entry* file)
+char* filetype_get_plugin(const struct entry* file, char *buffer, size_t buffer_len)
{
- static char plugin_name[MAX_PATH];
int index = find_attr(file->attr);
- if (index < 0)
+ if (index < 0 || !buffer)
return NULL;
if (filetypes[index].plugin == NULL)
return NULL;
- snprintf(plugin_name, MAX_PATH, "%s/%s.%s",
+ snprintf(buffer, buffer_len, "%s/%s.%s",
PLUGIN_DIR, filetypes[index].plugin, ROCK_EXTENSION);
- return plugin_name;
+ return buffer;
}
bool filetype_supported(int attr)