From 5bb2842a7c6f8276e9f1870b93eec10c9d2488de Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 18 Nov 2010 10:22:45 -0800 Subject: [PATCH] Remove StripVersion(), inlining the code to the one place it is used. --- MobileCydia.mm | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) 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; -- 2.45.2