summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/apps/tree.c b/apps/tree.c
index d87a93e2a0..44c4b92883 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -95,7 +95,6 @@ static char lastdir[MAX_PATH];
95#ifdef HAVE_TAGCACHE 95#ifdef HAVE_TAGCACHE
96static int lasttable, lastextra, lastfirstpos; 96static int lasttable, lastextra, lastfirstpos;
97#endif 97#endif
98static int max_files = 0;
99 98
100static bool reload_dir = false; 99static bool reload_dir = false;
101 100
@@ -391,7 +390,7 @@ static int update_dir(void)
391#ifdef HAVE_TAGCACHE 390#ifdef HAVE_TAGCACHE
392 !id3db && 391 !id3db &&
393#endif 392#endif
394 (tc.dirfull || tc.filesindir == global_settings.max_files_in_dir) ) 393 (tc.dirfull || tc.filesindir == tc.dircache_count) )
395 { 394 {
396 splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); 395 splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL));
397 } 396 }
@@ -1005,20 +1004,18 @@ int rockbox_browse(struct browse_context *browse)
1005 1004
1006void tree_mem_init(void) 1005void tree_mem_init(void)
1007{ 1006{
1008 /* We copy the settings value in case it is changed by the user. We can't
1009 use it until the next reboot. */
1010 max_files = global_settings.max_files_in_dir;
1011
1012 /* initialize tree context struct */ 1007 /* initialize tree context struct */
1013 memset(&tc, 0, sizeof(tc)); 1008 memset(&tc, 0, sizeof(tc));
1014 tc.dirfilter = &global_settings.dirfilter; 1009 tc.dirfilter = &global_settings.dirfilter;
1015 tc.sort_dir = global_settings.sort_dir; 1010 tc.sort_dir = global_settings.sort_dir;
1016 1011
1017 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH * max_files; 1012 tc.name_buffer_size = AVERAGE_FILENAME_LENGTH *
1013 global_settings.max_files_in_dir;
1018 tc.name_buffer = buffer_alloc(tc.name_buffer_size); 1014 tc.name_buffer = buffer_alloc(tc.name_buffer_size);
1019 1015
1020 tc.dircache_size = max_files * sizeof(struct entry); 1016 tc.dircache_count = global_settings.max_files_in_dir;
1021 tc.dircache = buffer_alloc(tc.dircache_size); 1017 tc.dircache = buffer_alloc(global_settings.max_files_in_dir *
1018 sizeof(struct entry));
1022 tree_get_filetypes(&filetypes, &filetypes_count); 1019 tree_get_filetypes(&filetypes, &filetypes_count);
1023} 1020}
1024 1021