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
|
--- bogofilter.c Thu Nov 7 07:05:58 2002
+++ bogofilter.c Fri Nov 22 12:51:33 2002
@@ -255,10 +255,14 @@
int compare_extrema(const void *id1, const void *id2)
{
+ double d;
const discrim_t *d1 = id1;
const discrim_t *d2 = id2;
- return ( (d1->prob > d2->prob) ||
- ((d1->prob == d2->prob) && (strcmp(d1->key, d2->key) > 0)));
+ d = d2->prob - d1->prob;
+ if (fabs(d) < EPS) return strcmp(d1->key, d2->key);
+ if (d1->prob > d2->prob) return 1;
+ if (d1->prob < d2->prob) return -1;
+ return 0;
}
void init_bogostats(bogostat_t *bogostats)
--- common.h Mon Oct 28 03:46:17 2002
+++ common.h Fri Nov 22 12:53:23 2002
@@ -9,6 +9,10 @@
#include <sys/param.h>
#endif
+#include <float.h>
+#define EPS (100.0 * DBL_EPSILON)
+
+
#include "debug.h"
#define GOODFILE "goodlist.db"
--- rstats.c Wed Nov 6 11:45:03 2002
+++ rstats.c Fri Nov 22 12:52:12 2002
@@ -84,10 +84,14 @@
int compare_rstats_t(const void *ir1, const void *ir2)
{
+ double d;
const rstats_t *r1 = *(rstats_t **)ir1;
const rstats_t *r2 = *(rstats_t **)ir2;
- return ( (r1->prob > r2->prob) ||
- ((r1->prob == r2->prob) && (strcmp(r1->token, r2->token) > 0)));
+ d = r1->prob - r2->prob;
+ if (fabs(d) < EPS) return strcmp(r1->token, r2->token);
+ if (r1->prob > r2->prob) return 1;
+ if (r1->prob < r2->prob) return -1;
+ return 0;
}
#define INTERVALS 10
--- version.h Fri Nov 22 12:55:52 2002
+++ version.h Fri Nov 22 12:55:13 2002
@@ -1,2 +1,2 @@
#undef VERSION
-#define VERSION "0.8.0.1"
+#define VERSION "0.8.0.freebsd2"
|