summaryrefslogtreecommitdiff
path: root/data/_apt7
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2010-02-24 10:01:00 +0000
committerJay Freeman <saurik@saurik.com>2010-02-24 10:01:00 +0000
commitd460e03e946ea2f8fa22fb1a8aa3a12b28b0a56c (patch)
treed507b358321f912db9029cf8e8871bff5828dbe6 /data/_apt7
parentbdd8443ab5d3268058b29e8eff96466854461fe2 (diff)
Slightly decrease the memory used by the Name tables.
git-svn-id: http://svn.telesphoreo.org/trunk@704 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/_apt7')
-rw-r--r--data/_apt7/tornado.diff (renamed from data/_apt7/vindication.diff)15
-rw-r--r--data/_apt7/unique.diff118
2 files changed, 127 insertions, 6 deletions
diff --git a/data/_apt7/vindication.diff b/data/_apt7/tornado.diff
index c07591be7..e276f3356 100644
--- a/data/_apt7/vindication.diff
+++ b/data/_apt7/tornado.diff
@@ -101,6 +101,14 @@ diff -Nru apt-0.7.25.3/apt-pkg/contrib/strutl.h apt-0.7.25.3+iPhone/apt-pkg/cont
inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \
inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
inline int name(const string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
+@@ -77,6 +77,7 @@
+ inline int name(const string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
+
+ #define APT_MKSTRCMP2(name,func) \
++inline int name(const srkString &A,const char *B) {return func(A.Start,A.Start+A.Size,B,B+strlen(B));}; \
+ inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
+ inline int name(const string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
+ inline int name(const string& A,const string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
diff -Nru apt-0.7.25.3/apt-pkg/deb/deblistparser.cc apt-0.7.25.3+iPhone/apt-pkg/deb/deblistparser.cc
--- apt-0.7.25.3/apt-pkg/deb/deblistparser.cc 2010-02-24 08:53:52.000000000 +0000
+++ apt-0.7.25.3+iPhone/apt-pkg/deb/deblistparser.cc 2010-02-24 08:51:50.000000000 +0000
@@ -637,7 +645,7 @@ diff -Nru apt-0.7.25.3/apt-pkg/pkgcache.h apt-0.7.25.3+iPhone/apt-pkg/pkgcache.h
diff -Nru apt-0.7.25.3/apt-pkg/srkstring.h apt-0.7.25.3+iPhone/apt-pkg/srkstring.h
--- apt-0.7.25.3/apt-pkg/srkstring.h 1970-01-01 00:00:00.000000000 +0000
+++ apt-0.7.25.3+iPhone/apt-pkg/srkstring.h 2010-02-24 08:37:27.000000000 +0000
-@@ -0,0 +1,64 @@
+@@ -0,0 +1,59 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: pkgcache.h,v 1.25 2001/07/01 22:28:24 jgg Exp $
@@ -691,11 +699,6 @@ diff -Nru apt-0.7.25.3/apt-pkg/srkstring.h apt-0.7.25.3+iPhone/apt-pkg/srkstring
+ operator std::string() { std::string Str; Str.assign(Start, Size); return Str; }
+};
+
-+int stringcasecmp(const char *lhsb, const char *lhse, const char *rhs);
-+inline int stringcasecmp(const srkString &lhs, const char *rhs) {
-+ return stringcasecmp(lhs.Start, lhs.Start + lhs.Size, rhs);
-+}
-+
+int stringcmp(const std::string &lhs, const char *rhsb, const char *rhse);
+inline bool operator ==(const std::string &lhs, const srkString &rhs) {
+ return stringcmp(lhs, rhs.begin(), rhs.end()) == 0;
diff --git a/data/_apt7/unique.diff b/data/_apt7/unique.diff
new file mode 100644
index 000000000..6086369a0
--- /dev/null
+++ b/data/_apt7/unique.diff
@@ -0,0 +1,118 @@
+diff -ru apt-0.7.25.3/apt-pkg/deb/deblistparser.cc apt-0.7.25.3+iPhone/apt-pkg/deb/deblistparser.cc
+--- apt-0.7.25.3/apt-pkg/deb/deblistparser.cc 2010-02-24 09:53:27.000000000 +0000
++++ apt-0.7.25.3+iPhone/apt-pkg/deb/deblistparser.cc 2010-02-24 09:42:05.000000000 +0000
+@@ -45,7 +45,7 @@
+ const char *Stop;
+ if (Section.Find(Tag,Start,Stop) == false)
+ return 0;
+- return WriteString(Start,Stop - Start);
++ return WriteString(srkString(Start,Stop - Start));
+ }
+ /*}}}*/
+ // ListParser::UniqFindTagWrite - Find the tag and write a unq string /*{{{*/
+diff -ru apt-0.7.25.3/apt-pkg/pkgcachegen.cc apt-0.7.25.3+iPhone/apt-pkg/pkgcachegen.cc
+--- apt-0.7.25.3/apt-pkg/pkgcachegen.cc 2010-02-24 09:53:27.000000000 +0000
++++ apt-0.7.25.3+iPhone/apt-pkg/pkgcachegen.cc 2010-02-24 09:51:06.000000000 +0000
+@@ -680,21 +680,38 @@
+ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
+ unsigned int Size)
+ {
++ return WriteString(srkString(S, Size), srkSeriouslyUnique);
++}
++
++unsigned long pkgCacheGenerator::WriteString(const srkString &S,
++ enum srkLevel level)
++{
++ if (level == srkRunOfTheMillNormal)
++ return Map.WriteString(S.Start,S.Size);
++
+ /* We use a very small transient hash table here, this speeds up generation
+ by a fair amount on slower machines */
+- pkgCache::StringItem *&Bucket = UniqHash[(S[0]*5 + S[1]) % _count(UniqHash)];
++ pkgCache::StringItem *&Bucket(level == srkReasonablySpecial ? SpecHash[(S[0]*5 + S[1]) % _count(SpecHash)] : UniqHash[(S[0]*5 + S[1]) % _count(UniqHash)]);
+ if (Bucket != 0 &&
+- stringcmp(S,S+Size,Cache.StrP + Bucket->String) == 0)
++ stringcmp(S,Cache.StrP + Bucket->String) == 0)
+ return Bucket->String;
+
++ pkgCache::StringItem *I;
++ map_ptrloc *Last;
++
++ if (level != srkSeriouslyUnique) {
++ I = NULL;
++ Last = NULL;
++ } else {
++
+ // Search for an insertion point
+- pkgCache::StringItem *I = Cache.StringItemP + Cache.HeaderP->StringList;
++ I = Cache.StringItemP + Cache.HeaderP->StringList;
+ int Res = 1;
+- map_ptrloc *Last = &Cache.HeaderP->StringList;
++ Last = &Cache.HeaderP->StringList;
+ for (; I != Cache.StringItemP; Last = &I->NextItem,
+ I = Cache.StringItemP + I->NextItem)
+ {
+- Res = stringcmp(S,S+Size,Cache.StrP + I->String);
++ Res = stringcmp(S,Cache.StrP + I->String);
+ if (Res >= 0)
+ break;
+ }
+@@ -705,6 +722,8 @@
+ Bucket = I;
+ return I->String;
+ }
++
++ }
+
+ // Get a structure
+ unsigned long Item = Map.Allocate(sizeof(pkgCache::StringItem));
+@@ -714,8 +733,9 @@
+ // Fill in the structure
+ pkgCache::StringItem *ItemP = Cache.StringItemP + Item;
+ ItemP->NextItem = I - Cache.StringItemP;
+- *Last = Item;
+- ItemP->String = Map.WriteString(S,Size);
++ if (Last != NULL)
++ *Last = Item;
++ ItemP->String = Map.WriteString(S.Start,S.Size);
+ if (ItemP->String == 0)
+ return 0;
+
+diff -ru apt-0.7.25.3/apt-pkg/pkgcachegen.h apt-0.7.25.3+iPhone/apt-pkg/pkgcachegen.h
+--- apt-0.7.25.3/apt-pkg/pkgcachegen.h 2010-02-24 09:53:27.000000000 +0000
++++ apt-0.7.25.3+iPhone/apt-pkg/pkgcachegen.h 2010-02-24 09:50:07.000000000 +0000
+@@ -32,13 +32,16 @@
+ {
+ private:
+
+- pkgCache::StringItem *UniqHash[26];
++ pkgCache::StringItem *UniqHash[24];
++ pkgCache::StringItem *SpecHash[2];
+
+ public:
+
+ class ListParser;
+ friend class ListParser;
+
++ enum srkLevel { srkRunOfTheMillNormal, srkReasonablySpecial, srkSeriouslyUnique };
++
+ protected:
+
+ DynamicMMap &Map;
+@@ -63,6 +66,7 @@
+
+ unsigned long WriteUniqString(const char *S,unsigned int Size);
+ inline unsigned long WriteUniqString(const string &S) {return WriteUniqString(S.c_str(),S.length());};
++ unsigned long WriteString(const srkString &S, enum srkLevel level);
+
+ void DropProgress() {Progress = 0;};
+ bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index,
+@@ -98,7 +102,7 @@
+ inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
+ inline unsigned long WriteString(const string &S) {return Owner->Map.WriteString(S);};
+ inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
+- inline unsigned long WriteString(const srkString &S) {return Owner->Map.WriteString(S.Start,S.Size);};
++ inline unsigned long WriteString(const srkString &S) {return Owner->WriteString(S, srkReasonablySpecial);};
+ bool NewDepends(pkgCache::VerIterator Ver,const string &Package,
+ const string &Version,unsigned int Op,
+ unsigned int Type);