From 56069476be65da87604d7b006aee7008445b965f Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 10 Mar 2010 08:56:27 +0000 Subject: Get rid of the parent_dir field in dir_uncached.c by using the same FAT trick as in dircache. This should save ~20KB on 512B/sector targets and ~80KB on 2K/sector ones. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25105 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/dir_uncached.c | 9 +++++++-- firmware/include/dir_uncached.h | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'firmware') diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c index 2052503c43..c6f3a6f2e1 100644 --- a/firmware/common/dir_uncached.c +++ b/firmware/common/dir_uncached.c @@ -114,11 +114,16 @@ DIR_UNCACHED* opendir_uncached(const char* name) } if ( (entry.attr & FAT_ATTR_DIRECTORY) && (!strcasecmp(part, entry.name)) ) { - pdir->parent_dir = pdir->fatdir; + /* in reality, the parent_dir parameter of fat_opendir is + * useless because it's sole purpose it to have a way to + * update the file metadata, but here we are only reading + * a directory so there's no need for that kind of stuff. + * Consequently, we can safely pass NULL of it because + * fat_opendir and fat_open are NULL-protected. */ if ( fat_opendir(IF_MV2(volume,) &pdir->fatdir, entry.firstcluster, - &pdir->parent_dir) < 0 ) { + NULL) < 0 ) { DEBUGF("Failed opening dir '%s' (%ld)\n", part, entry.firstcluster); pdir->busy = false; diff --git a/firmware/include/dir_uncached.h b/firmware/include/dir_uncached.h index e198833c84..4e5acf34d1 100644 --- a/firmware/include/dir_uncached.h +++ b/firmware/include/dir_uncached.h @@ -61,7 +61,6 @@ typedef struct { bool busy; long startcluster; struct fat_dir fatdir; - struct fat_dir parent_dir; struct dirent_uncached theent; #ifdef HAVE_MULTIVOLUME int volumecounter; /* running counter for faked volume entries */ -- cgit v1.2.3