aboutsummaryrefslogtreecommitdiff
path: root/common/archive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/archive.cpp')
-rw-r--r--common/archive.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index cac6680e76..91ed49c5c2 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -159,30 +159,29 @@ void FSDirectory::cacheDirectoryRecursive(FilesystemNode node, int depth, const
}
-int FSDirectory::matchPattern(StringList &list, const String &pattern) {
- if (pattern.empty() || !_node.isDirectory()) {
+int FSDirectory::getAllNames(StringList &list) {
+ if (!_node.isDirectory())
return 0;
- }
+ // Cache dir data
if (!_cached) {
cacheDirectoryRecursive(_node, _depth, "");
_cached = true;
}
- return Archive::matchPattern(list, pattern);
-}
-
-
-
-
-
-SearchSet::SearchSet() {
-
+ // Small optimization: Ensure the StringList has to grow at most once
+ list.reserve(list.size() + _fileCache.size());
+
+ // Add all filenames from our cache
+ NodeCache::iterator it = _fileCache.begin();
+ for ( ; it != _fileCache.end(); it++) {
+ list.push_back((*it)._key);
+ }
+
+ return _fileCache.size();
}
-SearchSet::~SearchSet() {
-}
SearchSet::ArchiveList::iterator SearchSet::find(const String &name) const {
ArchiveList::iterator it = _list.begin();