]> git.saurik.com Git - cydia.git/commitdiff
Further performance improvements.
authorJay Freeman (saurik) <saurik@saurk.com>
Sun, 19 Apr 2009 07:19:17 +0000 (07:19 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:13:12 +0000 (07:13 +0000)
Cydia.app/Sections.plist
Cydia.mm

index 351747c2d457fd86d41a7c0bd8e8c75258d40308..b18d4abeab1ebdfceaab2f67338bcbe566d0ee01 100644 (file)
         <string>Themes_(SpringBoard)</string>
     </dict>
 
-    <key>Themes_(LockScreen)</key>
-    <dict>
-        <key>Rename</key>
-        <string>Themes_(Lockscreen)</string>
-    </dict>
-
     <key>Intelliborn</key>
     <dict>
         <key>Rename</key>
index 2784d00b592c0520b164e6462d02079a5b62cfa4..3a410e0a3b9498ce9cf39dcb1e37a0636cdaadff 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1023,6 +1023,13 @@ NSString *SizeString(double size) {
     return [NSString stringWithFormat:@"%s%.1f %s", (negative ? "-" : ""), size, powers_[power]];
 }
 
+NSString *StripVersion(const char *version) {
+    const char *colon(strchr(version, ':'));
+    if (colon != NULL)
+        version = colon + 1;
+    return [NSString stringWithUTF8String:version];
+}
+
 NSString *StripVersion(NSString *version) {
     NSRange colon = [version rangeOfString:@":"];
     if (colon.location != NSNotFound)
@@ -1748,29 +1755,19 @@ uint32_t PackageChangesRadix(Package *self, void *) {
         database_ = database;
 
         _profile(Package$initWithVersion$Latest)
-            latest_ = [StripVersion([NSString stringWithUTF8String:version_.VerStr()]) retain];
-        _end
-
-        pkgCache::VerIterator current;
-        NSString *installed;
-
-        _profile(Package$initWithVersion$Current)
-            current = iterator_.CurrentVer();
-            installed = current.end() ? nil : [NSString stringWithUTF8String:current.VerStr()];
+            latest_ = [StripVersion(version_.VerStr()) retain];
         _end
 
-        _profile(Package$initWithVersion$Installed)
-            installed_ = [StripVersion(installed) retain];
-        _end
+        pkgCache::VerIterator current(iterator_.CurrentVer());
+        if (!current.end())
+            installed_ = [StripVersion(current.VerStr()) retain];
 
-        _profile(Package$initWithVersion$File)
-            if (!version_.end())
-                file_ = version_.FileList();
-            else {
-                pkgCache &cache([database_ cache]);
-                file_ = pkgCache::VerFileIterator(cache, cache.VerFileP);
-            }
-        _end
+        if (!version_.end())
+            file_ = version_.FileList();
+        else {
+            pkgCache &cache([database_ cache]);
+            file_ = pkgCache::VerFileIterator(cache, cache.VerFileP);
+        }
 
         _profile(Package$initWithVersion$Name)
             id_ = [[NSString stringWithUTF8String:iterator_.Name()] retain];
@@ -1789,63 +1786,36 @@ uint32_t PackageChangesRadix(Package *self, void *) {
                     parser = &[database_ records]->Lookup(file_);
                 _end
 
-                const char *begin, *end;
-                parser->GetRec(begin, end);
-
                 CYString website;
                 CYString tag;
 
-                struct {
-                    const char *name_;
-                    CYString *value_;
-                } names[] = {
-                    {"name", &name_},
-                    {"icon", &icon_},
-                    {"depiction", &depiction_},
-                    {"homepage", &homepage_},
-                    {"website", &website},
-                    {"support", &support_},
-                    {"sponsor", &sponsor_},
-                    {"author", &author_},
-                    {"tag", &tag},
-                };
-
-                while (begin != end)
-                    if (*begin == '\n') {
-                        ++begin;
-                        continue;
-                    } else if (isblank(*begin)) next: {
-                        begin = static_cast<char *>(memchr(begin + 1, '\n', end - begin - 1));
-                        if (begin == NULL)
-                            break;
-                    } else if (const char *colon = static_cast<char *>(memchr(begin, ':', end - begin))) {
-                        const char *name(begin);
-                        size_t size(colon - begin);
-
-                        begin = static_cast<char *>(memchr(begin, '\n', end - begin));
-
-                        {
-                            const char *stop(begin == NULL ? end : begin);
-                            while (stop[-1] == '\r')
-                                --stop;
-                            while (++colon != stop && isblank(*colon));
-
-                            for (size_t i(0); i != sizeof(names) / sizeof(names[0]); ++i)
-                                if (strncasecmp(names[i].name_, name, size) == 0) {
-                                    CYString &value(*names[i].value_);
-
-                                    _profile(Package$initWithVersion$Parse$Value)
-                                        value.set(pool, colon, stop - colon);
-                                    _end
-
-                                    break;
-                                }
+                _profile(Package$initWithVersion$Parse$Find)
+                    struct {
+                        const char *name_;
+                        CYString *value_;
+                    } names[] = {
+                        {"name", &name_},
+                        {"icon", &icon_},
+                        {"depiction", &depiction_},
+                        {"homepage", &homepage_},
+                        {"website", &website},
+                        {"support", &support_},
+                        {"sponsor", &sponsor_},
+                        {"author", &author_},
+                        {"tag", &tag},
+                    };
+
+                    for (size_t i(0); i != sizeof(names) / sizeof(names[0]); ++i) {
+                        const char *start, *end;
+
+                        if (parser->Find(names[i].name_, start, end)) {
+                            CYString &value(*names[i].value_);
+                            _profile(Package$initWithVersion$Parse$Value)
+                                value.set(pool, start, end - start);
+                            _end
                         }
-
-                        if (begin == NULL)
-                            break;
-                        ++begin;
-                    } else goto next;
+                    }
+                _end
 
                 _profile(Package$initWithVersion$Parse$Tagline)
                     tagline_.set(pool, parser->ShortDesc());
@@ -7920,7 +7890,7 @@ int main(int argc, char *argv[]) { _pooled
     Locale_ = CFLocaleCopyCurrent();
     Languages_ = [NSLocale preferredLanguages];
     //CFStringRef locale(CFLocaleGetIdentifier(Locale_));
-    NSLog(@"%@", [Languages_ description]);
+    //NSLog(@"%@", [Languages_ description]);
     const char *lang;
     if (Languages_ == nil || [Languages_ count] == 0)
         lang = NULL;