summaryrefslogtreecommitdiff
path: root/data/_apt7/hashtable.diff
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2009-04-27 10:05:44 +0000
committerJay Freeman <saurik@saurik.com>2009-04-27 10:05:44 +0000
commit0ab69dd9f7b48237939e03b775fb7b41d3b2438d (patch)
tree4ff087aaff14b346d8446b6d0ef53c986454c0f8 /data/_apt7/hashtable.diff
parenta3d69f9e957d210a1b7415ed3d2621d34be48c92 (diff)
Starting factor of apt7.
git-svn-id: http://svn.telesphoreo.org/trunk@606 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/_apt7/hashtable.diff')
-rw-r--r--data/_apt7/hashtable.diff61
1 files changed, 61 insertions, 0 deletions
diff --git a/data/_apt7/hashtable.diff b/data/_apt7/hashtable.diff
new file mode 100644
index 000000000..fe5c046c8
--- /dev/null
+++ b/data/_apt7/hashtable.diff
@@ -0,0 +1,61 @@
+diff -ru apt-0.7.20.2/apt-pkg/tagfile.cc apt-0.7.20.2+iPhone/apt-pkg/tagfile.cc
+--- apt-0.7.20.2/apt-pkg/tagfile.cc 2009-02-07 15:09:35.000000000 +0000
++++ apt-0.7.20.2+iPhone/apt-pkg/tagfile.cc 2009-04-19 02:42:49.000000000 +0000
+@@ -220,7 +220,10 @@
+ if (isspace(Stop[0]) == 0)
+ {
+ Indexes[TagCount++] = Stop - Section;
+- AlphaIndexes[AlphaHash(Stop,End)] = TagCount;
++ unsigned long hash(AlphaHash(Stop, End));
++ while (AlphaIndexes[hash] != 0)
++ hash = (hash + 1) % (sizeof(AlphaIndexes) / sizeof(AlphaIndexes[0]));
++ AlphaIndexes[hash] = TagCount;
+ }
+
+ Stop = (const char *)memchr(Stop,'\n',End - Stop);
+@@ -258,14 +261,16 @@
+ bool pkgTagSection::Find(const char *Tag,unsigned &Pos) const
+ {
+ unsigned int Length = strlen(Tag);
+- unsigned int I = AlphaIndexes[AlphaHash(Tag)];
+- if (I == 0)
+- return false;
+- I--;
++ unsigned int J = AlphaHash(Tag);
+
+- for (unsigned int Counter = 0; Counter != TagCount; Counter++,
+- I = (I+1)%TagCount)
++ for (unsigned int Counter = 0; Counter != TagCount; Counter++,
++ J = (J+1)%(sizeof(AlphaIndexes)/sizeof(AlphaIndexes[0])))
+ {
++ unsigned int I = AlphaIndexes[J];
++ if (I == 0)
++ return false;
++ I--;
++
+ const char *St;
+ St = Section + Indexes[I];
+ if (strncasecmp(Tag,St,Length) != 0)
+@@ -291,14 +296,16 @@
+ const char *&End) const
+ {
+ unsigned int Length = strlen(Tag);
+- unsigned int I = AlphaIndexes[AlphaHash(Tag)];
+- if (I == 0)
+- return false;
+- I--;
++ unsigned int J = AlphaHash(Tag);
+
+- for (unsigned int Counter = 0; Counter != TagCount; Counter++,
+- I = (I+1)%TagCount)
++ for (unsigned int Counter = 0; Counter != TagCount; Counter++,
++ J = (J+1)%(sizeof(AlphaIndexes)/sizeof(AlphaIndexes[0])))
+ {
++ unsigned int I = AlphaIndexes[J];
++ if (I == 0)
++ return false;
++ I--;
++
+ const char *St;
+ St = Section + Indexes[I];
+ if (strncasecmp(Tag,St,Length) != 0)