mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-14 07:32:35 -05:00
Small change to significantly reduce stack usage during database scanning. This should fix FS#10396.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21576 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
55b656d9c5
commit
8c22a60290
1 changed files with 20 additions and 7 deletions
|
|
@ -4091,13 +4091,30 @@ static bool check_deleted_files(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Note that this function must not be inlined, otherwise the whole point
|
||||||
|
* of having the code in a separate function is lost.
|
||||||
|
*/
|
||||||
|
static void __attribute__ ((noinline)) check_ignore(const char *dirname,
|
||||||
|
int *ignore, int *unignore)
|
||||||
|
{
|
||||||
|
char newpath[MAX_PATH];
|
||||||
|
|
||||||
|
/* check for a database.ignore file */
|
||||||
|
snprintf(newpath, MAX_PATH, "%s/database.ignore", dirname);
|
||||||
|
*ignore = file_exists(newpath);
|
||||||
|
/* check for a database.unignore file */
|
||||||
|
snprintf(newpath, MAX_PATH, "%s/database.unignore", dirname);
|
||||||
|
*unignore = file_exists(newpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool check_dir(const char *dirname, int add_files)
|
static bool check_dir(const char *dirname, int add_files)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
int len;
|
int len;
|
||||||
int success = false;
|
int success = false;
|
||||||
int ignore, unignore;
|
int ignore, unignore;
|
||||||
char newpath[MAX_PATH];
|
|
||||||
|
|
||||||
dir = opendir(dirname);
|
dir = opendir(dirname);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
|
|
@ -4106,12 +4123,8 @@ static bool check_dir(const char *dirname, int add_files)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for a database.ignore file */
|
/* check for a database.ignore and database.unignore */
|
||||||
snprintf(newpath, MAX_PATH, "%s/database.ignore", dirname);
|
check_ignore(dirname, &ignore, &unignore);
|
||||||
ignore = file_exists(newpath);
|
|
||||||
/* check for a database.unignore file */
|
|
||||||
snprintf(newpath, MAX_PATH, "%s/database.unignore", dirname);
|
|
||||||
unignore = file_exists(newpath);
|
|
||||||
|
|
||||||
/* don't do anything if both ignore and unignore are there */
|
/* don't do anything if both ignore and unignore are there */
|
||||||
if (ignore != unignore)
|
if (ignore != unignore)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue