summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-12-01 15:52:05 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2010-12-01 15:52:05 -0800
commit9f357d113a67b31f1d0955f9b44474f0a4b0de69 (patch)
tree74c9ac6104e42969540dee290429dd379ae59d1a
parent991d7f6c5637f27563b2e0bc9d8cb9397126b5f4 (diff)
Cache the Database::packages_ capacity in Cytore.
-rw-r--r--MobileCydia.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 46d5ddf..4dd2b57 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1447,6 +1447,7 @@ struct PackageValue :
struct MetaValue :
Cytore::Block
{
+ uint32_t active_;
Cytore::Offset<PackageValue> packages_[1 << 16];
};
@@ -3154,7 +3155,13 @@ static NSString *Warning_;
zone_ = NSCreateZone(1024 * 1024, 256 * 1024, NO);
apr_pool_create(&pool_, NULL);
- packages_ = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL);
+ size_t capacity(MetaFile_->active_);
+ if (capacity == 0)
+ capacity = 16384;
+ else
+ capacity += 1024;
+
+ packages_ = CFArrayCreateMutable(kCFAllocatorDefault, capacity, NULL);
int fds[2];
@@ -3477,6 +3484,8 @@ static NSString *Warning_;
_trace();
size_t count(CFArrayGetCount(packages_));
+ MetaFile_->active_ = count;
+
for (size_t index(0); index != count; ++index)
[(Package *) CFArrayGetValueAtIndex(packages_, index) setIndex:index];