summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-11-18 10:23:11 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2010-11-18 10:23:11 -0800
commit5699667afc26b1e9068364495dc94403e0253065 (patch)
tree149abec316d4f1fc09601097d938c0d839ef5030
parent1c1dfc2dd3287a2b1da5dcdc53c835d67621029c (diff)
Replace Package::cached_ with Package::source_ == [NSNull null].
-rw-r--r--MobileCydia.mm21
1 files changed, 6 insertions, 15 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 0208bad..ebe42b4 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1703,7 +1703,6 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;
pkgCache::VerFileIterator file_;
Source *source_;
- bool cached_;
bool parsed_;
CYString section_;
@@ -2126,10 +2125,7 @@ struct PackageNameOrdering :
if (!file_.end()) {
_profile(Package$initWithVersion$Source)
- source_ = [database_ getSource:file_.File()];
- if (source_ != nil)
- [source_ retain];
- cached_ = true;
+ source_ = [([database_ getSource:file_.File()] ?: (Source *) [NSNull null]) retain];
_end
}
@@ -2632,21 +2628,16 @@ struct PackageNameOrdering :
}
- (Source *) source {
- if (!cached_) {
+ if (source_ == nil) {
@synchronized (database_) {
if ([database_ era] != era_ || file_.end())
- source_ = nil;
- else {
- source_ = [database_ getSource:file_.File()];
- if (source_ != nil)
- [source_ retain];
- }
-
- cached_ = true;
+ source_ = (Source *) [NSNull null];
+ else
+ source_ = [([database_ getSource:file_.File()] ?: (Source *) [NSNull null]) retain];
}
}
- return source_;
+ return source_ == (Source *) [NSNull null] ? nil : source_;
}
- (NSString *) role {