mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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
This commit is contained in:
parent
e1553d860d
commit
9878226e4d
3 changed files with 17 additions and 15 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue