~ubuntu-branches/ubuntu/wily/maradns/wily-proposed

« back to all changes in this revision

Viewing changes to deadwood-3.2.05/update/3.1.03/deadwood-3.1.02-hash_bucket.patch

  • Committer: Package Import Robot
  • Author(s): Dariusz Dwornikowski, Tomasz Buchert, Dariusz Dwornikowski
  • Date: 2015-03-27 18:34:08 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20150327183408-wnfachdkdjt96yu6
Tags: 2.0.11-1
[ Tomasz Buchert ]
* Imported Upstream version 2.0.11

[ Dariusz Dwornikowski ]
* d/patches: 
  - refreshed all patches for new deadwood version
  - removed generating of random prime on build (Closes: #785536) 
* d/rules: date taken from changelog (Closes: #785535)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--- deadwood-3.1.02/src/DwDict.c        2011-11-27 20:30:55.000000000 -0600
2
 
+++ deadwood-3.1.03/src/DwDict.c        2011-12-18 18:04:23.870403471 -0600
3
 
@@ -1,4 +1,4 @@
4
 
-/* Copyright (c) 2009 Sam Trenholme
5
 
+/* Copyright (c) 2009, 2011 Sam Trenholme
6
 
  *
7
 
  * TERMS
8
 
  *
9
 
@@ -36,6 +36,10 @@
10
 
 #include "DwStr_functions.h"
11
 
 #include "DwDict.h"
12
 
 
13
 
+/* Keep -Wall happy.  We can "legally" call this since we are a, if you
14
 
+ * will, "derived class" of DwHash.c */
15
 
+uint32_t dwh_hash_compress(dw_str *obj);
16
 
+
17
 
 /* Initialize a Deadwood dictionary store */
18
 
 dwd_dict *dwd_init() {
19
 
         return dwh_hash_init(2);
20
 
@@ -84,10 +88,13 @@
21
 
 
22
 
         if(key == 0) {
23
 
                 found = 1;
24
 
+                count = 0;
25
 
+        } else {
26
 
+                count = dwh_hash_compress(key) & hash->mask; /* Fast lookup */
27
 
         }
28
 
 
29
 
         /* Look for the key */
30
 
-        for(count = 0; count <= hash->mask; count++) {
31
 
+        for(;count <= hash->mask; count++) {
32
 
                 point = hash->hash[count];
33
 
                 for(noloop = 0; noloop < 10000 && point != 0; noloop++) {
34
 
                         next = point->next;