summaryrefslogtreecommitdiff
path: root/mail/ezmlm/files/patch-althash
blob: b0565418c1ffe81c7eabd9d17c66e4873b12de0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Attached below are diffs. They convert the hashing to do:
   '@'..'Z'

It's not that great as a hashing algorithm since you end up with a
non-prime number that's reasonably close to a power of 2 for your number
of buckets, but hey.

It's possible one other place (in constmap) needs to be changed. DJB's
code scares me in its lack of constants and lack of subroutines to
factor away similar bits of code.

Test it and see if it works.


cheers,
-- 
Iain.


--- ezmlm-list.c.orig	1997-06-29 23:11:54.000000000 -0400
+++ ezmlm-list.c
@@ -36,7 +36,7 @@ char **argv;
   if (chdir(dir) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",dir,": ");
 
-  for (fn[12] = 64;fn[12] < 64 + 53;++fn[12]) {
+  for (fn[12] = 64;fn[12] < 64 + 27;++fn[12]) {
     fd = open_read(fn);
     if (fd == -1) {
       if (errno != error_noent)
--- ezmlm-send.c.orig	1997-06-29 23:11:54.000000000 -0400
+++ ezmlm-send.c
@@ -288,7 +288,7 @@ char **argv;
 
   qmail_from(&qq,line.s);
 
-  for (i = 0;i < 53;++i) {
+  for (i = 0;i < 27;++i) {
     ch = 64 + i;
     if (!stralloc_copys(&fnsub,"subscribers/")) die_nomem();
     if (!stralloc_catb(&fnsub,&ch,1)) strerr_die2x(111,FATAL,"out of memory");
--- ezmlm.5.orig	1997-06-29 23:11:54.000000000 -0400
+++ ezmlm.5
@@ -30,10 +30,10 @@ allows automatic subscription if
 .I dir\fB/public
 exists.
 
-The list is hashed into 53 files, named
+The list is hashed into 27 files, named
 .B @ 
 through
-.B t
+.B Z
 in ASCII.
 A nonexistent file is treated as an empty file.
 
--- issub.c.orig	1997-06-29 23:11:54.000000000 -0400
+++ issub.c
@@ -35,7 +35,7 @@ char *userhost;
   h = 5381;
   for (j = 0;j < addr.len;++j)
     h = (h + (h << 5)) ^ (uint32) (unsigned char) addr.s[j];
-  ch = 64 + (h % 53);
+  ch = 64 + (h % 27);
 
   if (!stralloc_0(&addr)) return -2;
 
--- subscribe.c.orig	1997-06-29 23:11:54.000000000 -0400
+++ subscribe.c
@@ -45,7 +45,7 @@ int flagadd;
   h = 5381;
   for (j = 0;j < addr.len;++j)
     h = (h + (h << 5)) ^ (uint32) (unsigned char) addr.s[j];
-  ch = 64 + (h % 53);
+  ch = 64 + (h % 27);
 
   if (!stralloc_0(&addr)) return -2;