mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
dircache: use alloca to avoid VLA in struct extension
Clang does not support VLA-in-struct so use alloca to do the same thing by hand. Change-Id: Ib135d1a90b00aac3098e4c64f9f5f5e397fe771c
This commit is contained in:
parent
8cfa4bfd8c
commit
0b52c28933
1 changed files with 4 additions and 7 deletions
|
|
@ -1395,15 +1395,12 @@ static void sab_process_dir(struct file_base_info *infop, bool issab)
|
|||
should also filled in beforehand */
|
||||
|
||||
/* allocate the stack right now to the max demand */
|
||||
struct dirsab
|
||||
{
|
||||
struct sab sab;
|
||||
struct sab_component stack[issab ? DIRCACHE_MAX_DEPTH : 1];
|
||||
} dirsab;
|
||||
struct sab *sabp = &dirsab.sab;
|
||||
size_t stackdepth = (issab ? DIRCACHE_MAX_DEPTH : 1);
|
||||
struct sab *sabp = alloca(sizeof(*sabp) +
|
||||
sizeof(sabp->stack[0]) * stackdepth);
|
||||
|
||||
sabp->quit = false;
|
||||
sabp->stackend = &sabp->stack[ARRAYLEN(dirsab.stack)];
|
||||
sabp->stackend = &sabp->stack[stackdepth];
|
||||
sabp->top = sabp->stackend;
|
||||
sabp->info = *infop;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue