]> git.saurik.com Git - cydia.git/blobdiff - MobileCydia.mm
Allow profiling usage of Database::sections_ in -[Database mappedSectionForPointer:].
[cydia.git] / MobileCydia.mm
index 2756250927cdf4b52c0d58c95056b17f2a8b4cc7..b7050fc6d3dafbded0ce1e5468f64f2a1b8bd902 100644 (file)
@@ -2478,12 +2478,12 @@ struct PackageNameOrdering :
 
 - (BOOL) unfiltered {
     _profile(Package$unfiltered$obsolete)
-        if (obsolete_)
+        if (_unlikely(obsolete_))
             return false;
     _end
 
     _profile(Package$unfiltered$hasSupportingRole)
-        if (![self hasSupportingRole])
+        if (_unlikely(![self hasSupportingRole]))
             return false;
     _end
 
@@ -3685,9 +3685,13 @@ static NSString *Warning_;
 }
 
 - (NSString *) mappedSectionForPointer:(const char *)section {
-    _H<NSString> &mapped(sections_[section]);
+    _H<NSString> *mapped;
 
-    if (mapped == NULL) {
+    _profile(Database$mappedSectionForPointer$Cache)
+        mapped = &sections_[section];
+    _end
+
+    if (*mapped == NULL) {
         size_t length(strlen(section));
         char spaced[length + 1];
 
@@ -3704,9 +3708,11 @@ static NSString *Warning_;
         _end
 
         _profile(Database$mappedSectionForPointer$Map)
-            mapped = [SectionMap_ objectForKey:string] ?: string;
+            string = [SectionMap_ objectForKey:string] ?: string;
         _end
-    } return mapped;
+
+        *mapped = string;
+    } return *mapped;
 }
 
 @end