summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2010-11-30 04:55:31 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2010-11-30 14:37:50 -0800
commit7b41e8f17a60047b5424dc2dc5e181e0925b6159 (patch)
tree1ea6b0f31301206d59ce1c5726764f5d312eba34
parent12016ee54adaf95441c09db51234c8b70d260e94 (diff)
Don't copy strings from APT when you can point to them.
-rw-r--r--MobileCydia.mm22
1 files changed, 14 insertions, 8 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index bea252e..ae9f0aa 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -772,10 +772,16 @@ class CYString {
else {
clear_();
- char *temp(reinterpret_cast<char *>(apr_palloc(pool, size + 1)));
- memcpy(temp, data, size);
- temp[size] = '\0';
- data_ = temp;
+ if (pool == NULL)
+ data_ = const_cast<char *>(data);
+ else {
+ char *temp(reinterpret_cast<char *>(apr_palloc(pool, size + 1)));
+ memcpy(temp, data, size);
+ temp[size] = '\0';
+
+ data_ = temp;
+ }
+
size_ = size;
}
}
@@ -2194,14 +2200,14 @@ struct PackageNameOrdering :
database_ = database;
_profile(Package$initWithVersion$Latest)
- latest_.set(pool_, StripVersion_(version_.VerStr()));
+ latest_.set(NULL, StripVersion_(version_.VerStr()));
_end
pkgCache::VerIterator current;
_profile(Package$initWithVersion$Versions)
current = iterator_.CurrentVer();
if (!current.end())
- installed_.set(pool_, StripVersion_(current.VerStr()));
+ installed_.set(NULL, StripVersion_(current.VerStr()));
if (!version_.end())
file_ = version_.FileList();
@@ -2213,7 +2219,7 @@ struct PackageNameOrdering :
_profile(Package$initWithVersion$Name)
id_.set(pool_, iterator_.Name());
- name_.set(pool, iterator_.Display());
+ name_.set(NULL, iterator_.Display());
_end
_profile(Package$initWithVersion$lowercaseString)
@@ -2260,7 +2266,7 @@ struct PackageNameOrdering :
_end
_profile(Package$initWithVersion$Section)
- section_.set(pool_, iterator_.Section());
+ section_.set(NULL, iterator_.Section());
_end
_profile(Package$initWithVersion$hasTag)