From: Jay Freeman (saurik) Date: Thu, 18 Nov 2010 18:22:45 +0000 (-0800) Subject: Remove StripVersion(), inlining the code to the one place it is used. X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/5bb2842a7c6f8276e9f1870b93eec10c9d2488de?hp=96291f7240f7e5ee4cae0912c14cf49345e64441 Remove StripVersion(), inlining the code to the one place it is used. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index 68fc710e..0208bad3 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1075,23 +1075,13 @@ NSString *SizeString(double size) { return [NSString stringWithFormat:@"%s%.1f %s", (negative ? "-" : ""), size, powers_[power]]; } -const char *StripVersion_(const char *version) { +static _finline const char *StripVersion_(const char *version) { const char *colon(strchr(version, ':')); if (colon != NULL) version = colon + 1; return version; } -// XXX: rename this to involve "Create" -CFStringRef StripVersion(const char *version) { - const char *colon(strchr(version, ':')); - if (colon != NULL) - version = colon + 1; - return CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast(version), strlen(version), kCFStringEncodingUTF8, NO); - // XXX: performance - return CYStringCreate(version); -} - NSString *LocalizeSection(NSString *section) { static Pcre title_r("^(.*?) \\((.*)\\)$"); if (title_r(section)) { @@ -2104,7 +2094,8 @@ struct PackageNameOrdering : database_ = database; _profile(Package$initWithVersion$Latest) - latest_ = (NSString *) StripVersion(version_.VerStr()); + const char *latest(StripVersion_(version_.VerStr())); + latest_ = (NSString *) CFStringCreateWithBytes(kCFAllocatorDefault, reinterpret_cast(latest), strlen(latest), kCFStringEncodingASCII, NO); _end pkgCache::VerIterator current;