[Scummvm-cvs-logs] SF.net SVN: scummvm:[35140] scummvm/trunk/common
wjpalenstijn at users.sourceforge.net
wjpalenstijn at users.sourceforge.net
Fri Nov 21 14:29:53 CET 2008
Revision: 35140
http://scummvm.svn.sourceforge.net/scummvm/?rev=35140&view=rev
Author: wjpalenstijn
Date: 2008-11-21 13:29:53 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
refactor inconsistent calls to cacheDirectoryRecursive
Modified Paths:
--------------
scummvm/trunk/common/archive.cpp
scummvm/trunk/common/archive.h
Modified: scummvm/trunk/common/archive.cpp
===================================================================
--- scummvm/trunk/common/archive.cpp 2008-11-21 12:17:35 UTC (rev 35139)
+++ scummvm/trunk/common/archive.cpp 2008-11-21 13:29:53 UTC (rev 35140)
@@ -127,10 +127,7 @@
FSNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
// make caching as lazy as possible
if (!name.empty()) {
- if (!_cached) {
- cacheDirectoryRecursive(_node, _depth, _prefix);
- _cached = true;
- }
+ ensureCached();
if (cache.contains(name))
return cache[name];
@@ -237,15 +234,19 @@
}
+void FSDirectory::ensureCached()
+{
+ if (_cached) return;
+ cacheDirectoryRecursive(_node, _depth, _prefix);
+ _cached = true;
+}
+
int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) {
if (!_node.isDirectory())
return 0;
// Cache dir data
- if (!_cached) {
- cacheDirectoryRecursive(_node, _depth, "");
- _cached = true;
- }
+ ensureCached();
String lowercasePattern(pattern);
lowercasePattern.toLowercase();
Modified: scummvm/trunk/common/archive.h
===================================================================
--- scummvm/trunk/common/archive.h 2008-11-21 12:17:35 UTC (rev 35139)
+++ scummvm/trunk/common/archive.h 2008-11-21 13:29:53 UTC (rev 35140)
@@ -165,6 +165,8 @@
// cache management
void cacheDirectoryRecursive(FSNode node, int depth, const String& prefix);
+ // fill cache if not already cached
+ void ensureCached();
bool _cached;
int _depth;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list