From 9f357d113a67b31f1d0955f9b44474f0a4b0de69 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 1 Dec 2010 15:52:05 -0800 Subject: Cache the Database::packages_ capacity in Cytore. --- MobileCydia.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 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]; -- cgit v1.2.3