Intel C++ 8 monster patch
Matthias Andree
matthias.andree at gmx.de
Fri Jan 30 22:14:04 CET 2004
David,
I am enclosing a diffstat and a cvs diff for pending deltas to quench
Intel C++ warnings and notes. I have already committed the safe parts,
but these are a bit more intrusive, so I'd like to negotiate the merge
date first.
Please let me know when I should commit these changes.
They have been test compiled on Solaris 8 SPARC64 with GCC 3.2 and Sun
Workshop, SuSE Linux 8.2 i386 with GCC 3.3, 2.95.3, 2.7.2 and
ICC 8.0.055, FreeBSD 4.9 with gcc 2.95.3+FreeBSD ext's, no regressions
reported.
Note that the configure.ac changes qualify as a bug fix because the
SETVBUF_REVERSED check falsely reports "yes" on ICC which leads to
segfaults (make check exposes these).
Cheers,
--
Matthias Andree
Encrypt your mail: my GnuPG key ID is 0x052E7D95
-------------- next part --------------
# Makefile.am | 2 +-
# configure.ac | 17 +++++++++++++++--
# src/Makefile.am | 13 ++++++++-----
# src/bogoconfig.c | 9 ---------
# src/bogohist.c | 4 ++--
# src/bogolexer.c | 21 ++++++++++-----------
# src/bogoreader.c | 16 ++++++++++------
# src/bogotune.c | 43 ++++++++++++++++++++-----------------------
# src/bogoutil.c | 8 +++-----
# src/bogowordfreq.c | 30 ++++++++++++++----------------
# src/common.h | 9 ++++++++-
# src/datastore.c | 11 +++++------
# src/find_home_tildeexpand.c | 4 ++--
# src/fisher.c | 2 +-
# src/format.c | 10 +++++-----
# src/globals.h | 8 ++++++++
# src/lexer.c | 25 +++++++++++--------------
# src/lexer.h | 5 +++++
# src/main.c | 2 --
# src/method.c | 2 --
# src/mime.c | 10 +++++-----
# src/msgcounts.c | 6 +++---
# src/passthrough.c | 4 ++--
# src/paths.c | 2 +-
# src/register.c | 3 ---
# src/robinson.c | 2 --
# src/rstats.c | 6 ------
# src/textblock.c | 2 +-
# src/wordhash.c | 5 ++---
# src/wordhash.main.c | 14 ++++++--------
# src/wordlists.c | 3 ---
# 31 files changed, 148 insertions(+), 150 deletions(-)
-------------- next part --------------
Index: Makefile.am
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/Makefile.am,v
retrieving revision 1.143
diff -u -r1.143 Makefile.am
--- Makefile.am 30 Jan 2004 20:51:20 -0000 1.143
+++ Makefile.am 30 Jan 2004 21:06:41 -0000
@@ -32,7 +32,7 @@
cvs-check:
rm -rf $(PACKAGE)-$(VERSION)-export
- cvs export -rHEAD -d $(PACKAGE)-$(VERSION)-export $(PACKAGE)
+ cvs -d "`cat $(srcdir)/CVS/Root`" export -rHEAD -d $(PACKAGE)-$(VERSION)-export $(PACKAGE)
cd $(PACKAGE)-$(VERSION)-export && autoreconf -i -f -s \
&& ./configure && make distcheck
Index: configure.ac
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/configure.ac,v
retrieving revision 1.240
diff -u -r1.240 configure.ac
--- configure.ac 23 Jan 2004 14:07:33 -0000 1.240
+++ configure.ac 30 Jan 2004 21:06:41 -0000
@@ -94,9 +94,17 @@
dnl If we're using gcc, enable some warnings
dnl missing: -Wunreachable-code
+if test "$GCC" = yes ; then
+ AC_MSG_CHECKING([if gcc is really Intel C++])
+ case "`$CC -V 2>&1`" in
+ [[iI][nN][tT][eE][lL]]*) ICC=yes ;;
+ *) ICC=no ;;
+ esac
+ AC_MSG_RESULT($ICC)
+fi
AC_CACHE_CHECK(for additional compiler options, ac_cv_prog_gcc_flags, [
ac_cv_prog_gcc_flags=""
-if test "$GCC" = yes
+if test "$GCC" = yes && test "$ICC" = no
then
echo "void dummy(void);" >configure-dummy.c
echo "void dummy(void) {}" >>configure-dummy.c
@@ -241,7 +249,12 @@
AC_TYPE_UID_T
AC_TYPE_SIGNAL
AC_FUNC_SELECT_ARGTYPES
+if test "$ICC" = no ; then
+# AC_FUNC_SETVBUF_REVERSED for some reason reports a bogus "yes"
+# with Intel C++ that leads to SIGSEGV at run time.
+# Skip the test on ICC.
AC_FUNC_SETVBUF_REVERSED
+fi
AC_CHECK_TYPES([uint, ulong, uint32_t, u_int32_t, int32_t, int16_t, u_int16_t, uint16_t, u_int8_t])
AC_CHECK_TYPE(u_long, unsigned long)
AC_CACHE_SAVE
@@ -471,7 +484,7 @@
dnl END EMBEDDED GSL
AH_BOTTOM([
-#if HAVE_EXTENDED_PRECISION_REGISTERS
+#ifdef HAVE_EXTENDED_PRECISION_REGISTERS
#define GSL_COERCE_DBL(x) (gsl_coerce_double(x))
#else
#define GSL_COERCE_DBL(x) (x)
Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/Makefile.am,v
retrieving revision 1.77
diff -u -r1.77 Makefile.am
--- src/Makefile.am 26 Jan 2004 03:06:53 -0000 1.77
+++ src/Makefile.am 30 Jan 2004 21:06:41 -0000
@@ -118,11 +118,13 @@
datastore_db.h \
mysetvbuf.c mysetvbuf.h
-BUILT_SOURCES= version.c
+BUILT_SOURCES= version.c directories.c
libbogofilter_a_SOURCES = \
- directories.c version.c \
- $(version_sources)
+ $(version_sources) version.c
+
+nodist_libbogofilter_a_SOURCES = \
+ directories.c
if ENABLE_TDB_DATASTORE
datastore_SOURCE = datastore_tdb.c
@@ -194,8 +196,9 @@
|| { rm -f "$@" ; false ; }
#
directories.c: ../config.status
- echo "const char *const system_config_file = \"$(SYSCONFDIR)/bogofilter.cf\";" >"$@" \
- || rm -f "$@"
+ ( echo "#include \"globals.h\"" && \
+ echo "const char *const system_config_file = \"$(SYSCONFDIR)/bogofilter.cf\";" ) >"$@" \
+ || { rm -f "$@" ; false ; }
#
.l.c:
flex -o$@.new $< && \
Index: src/bogoconfig.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoconfig.c,v
retrieving revision 1.148
diff -u -r1.148 bogoconfig.c
--- src/bogoconfig.c 30 Jan 2004 05:06:08 -0000 1.148
+++ src/bogoconfig.c 30 Jan 2004 21:06:42 -0000
@@ -23,8 +23,6 @@
#include <errno.h>
#include <unistd.h>
-extern char *optarg;
-extern int optind, opterr, optopt;
#include "bogoconfig.h"
#include "bogofilter.h"
@@ -98,13 +96,6 @@
static bool get_parsed_value(char **arg, double *parm);
static void comma_parse(char opt, const char *arg, double *parm1, double *parm2, double *parm3);
-/* externs for query_config() */
-
-extern double robx, robs;
-#ifdef ENABLE_DEPRECATED_CODE
-extern wl_t wl_default;
-#endif
-
/*---------------------------------------------------------------------------*/
/* Notes:
Index: src/bogohist.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogohist.c,v
retrieving revision 1.4
diff -u -r1.4 bogohist.c
--- src/bogohist.c 8 Jan 2004 17:58:58 -0000 1.4
+++ src/bogohist.c 30 Jan 2004 21:06:42 -0000
@@ -24,8 +24,8 @@
#include "word.h"
#include "wordlists.h"
-uint ham_only, ham_hapax;
-uint spam_only, spam_hapax;
+static uint ham_only, ham_hapax;
+static uint spam_only, spam_hapax;
#define INTERVALS 20
#define PCT(n) 100.0 * n / count
Index: src/bogolexer.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogolexer.c,v
retrieving revision 1.62
diff -u -r1.62 bogolexer.c
--- src/bogolexer.c 30 Jan 2004 05:06:08 -0000 1.62
+++ src/bogolexer.c 30 Jan 2004 21:06:42 -0000
@@ -17,8 +17,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-extern char *optarg;
-extern int optind, opterr, optopt;
#include "bogoconfig.h"
#include "bogoreader.h"
@@ -29,6 +27,7 @@
#include "textblock.h"
#include "token.h"
#include "mime.h"
+#include "format.h"
const char *progname = "bogolexer";
@@ -61,7 +60,6 @@
#ifdef ENABLE_DEPRECATED_CODE
static void process_args_2(int argc, char **argv);
#endif
-void initialize(void);
/* Function Definitions */
@@ -70,6 +68,14 @@
fprintf(stderr, "Usage: %s [ -p | -q | -n | -h ]\n", progname);
}
+static void initialize(void)
+{
+ init_charset_table(charset_default, true);
+ mime_reset();
+ token_init();
+ lexer_v3_init(NULL);
+}
+
static void help(void)
{
usage();
@@ -261,7 +267,7 @@
}
#endif
-int count=0;
+static int count=0;
int main(int argc, char **argv)
{
@@ -311,10 +317,3 @@
return 0;
}
-void initialize()
-{
- init_charset_table(charset_default, true);
- mime_reset();
- token_init();
- lexer_v3_init(NULL);
-}
Index: src/bogoreader.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoreader.c,v
retrieving revision 1.53
diff -u -r1.53 bogoreader.c
--- src/bogoreader.c 26 Jan 2004 16:34:32 -0000 1.53
+++ src/bogoreader.c 30 Jan 2004 21:06:42 -0000
@@ -23,6 +23,8 @@
** msg-count special for bogofilter
*/
+#define __USE_POSIX 1
+
#include "common.h"
#include <ctype.h>
@@ -98,15 +100,15 @@
reader_line_t *fcn;
} sep_2_box_t;
-sep_2_box_t sep_2_box[] = {
+static sep_2_box_t sep_2_box[] = {
{ "From ", 5, MBOX, mailbox_getline },
{ "\".MSG_COUNT\"", 12, MC, mailbox_getline }, /* msg-count */
{ "#! rmail", 8, RMAIL, rmail_getline },
{ "MAIL FROM:", 10, ANT, ant_getline } /* RISC-OS only */
};
-uint seplen = 0;
-const char *separator = NULL;
+static uint seplen = 0;
+static const char *separator = NULL;
static void dir_init(const char *name);
static void dir_fini(void);
@@ -261,7 +263,8 @@
mailstore_next_mail = mbox_mode ? mailbox_next_mail : mail_next_mail;
return true;
}
- break; /* not reached */
+ /*NOTREACHED*/
+ break;
case IS_DIR:
if (ismaildir(filename) == IS_DIR) {
/* MAILDIR */
@@ -278,7 +281,8 @@
mailstore_next_mail = dir_next_mail;
return true;
}
- break; /* notreached */
+ /*NOTREACHED*/
+ break;
case IS_ERR:
default:
fprintf(stderr, "Can't identify type of mailstore '%s'\n", filename);
@@ -359,7 +363,7 @@
struct dirent *dirent;
struct stat st;
- while(true) {
+ for(;;) {
if (reader_dir == NULL) {
char *x = dir_name;
/* open next directory */
Index: src/bogotune.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogotune.c,v
retrieving revision 1.101
diff -u -r1.101 bogotune.c
--- src/bogotune.c 30 Jan 2004 05:06:08 -0000 1.101
+++ src/bogotune.c 30 Jan 2004 21:06:43 -0000
@@ -119,40 +119,37 @@
/* Global Variables */
const char *progname = "bogotune";
-char *ds_file;
-char *ds_path;
-
-extern double robx, robs;
+static char *ds_file;
+static char *ds_path;
bool bogolex = false; /* true if convert input to msg-count format */
-char *bogolex_file = NULL;
-word_t *w_msg_count;
-wordhash_t *t_ns, *t_sp;
+static char *bogolex_file = NULL;
+static word_t *w_msg_count;
-tunelist_t *ns_and_sp;
-tunelist_t *ns_msglists, *sp_msglists;
+static tunelist_t *ns_and_sp;
+static tunelist_t *ns_msglists, *sp_msglists;
-flhead_t *spam_files, *ham_files;
+static flhead_t *spam_files, *ham_files;
typedef struct {
uint cnt;
double *data;
} data_t;
-data_t *rsval;
-data_t *rxval;
-data_t *mdval;
-
-uint target;
-uint ns_cnt, sp_cnt;
-
-double check_percent; /* initial check for excessively high/low scores */
-double *ns_scores;
-double *sp_scores;
-double user_robx = 0.0; /* from option '-r value' */
-uint coerced_target = 0; /* user supplied with '-T value' */
+static data_t *rsval;
+static data_t *rxval;
+static data_t *mdval;
+
+static uint target;
+static uint ns_cnt, sp_cnt;
+
+static double check_percent; /* initial check for excessively high/low scores */
+static double *ns_scores;
+static double *sp_scores;
+static double user_robx = 0.0; /* from option '-r value' */
+static uint coerced_target = 0; /* user supplied with '-T value' */
-uint ncnt, nsum; /* neighbor count and sum - for gfn() averaging */
+static uint ncnt, nsum; /* neighbor count and sum - for gfn() averaging */
#undef TEST
Index: src/bogoutil.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogoutil.c,v
retrieving revision 1.94
diff -u -r1.94 bogoutil.c
--- src/bogoutil.c 30 Jan 2004 05:06:08 -0000 1.94
+++ src/bogoutil.c 30 Jan 2004 21:06:44 -0000
@@ -18,8 +18,6 @@
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
-extern char *optarg;
-extern int optind, opterr, optopt;
#include "bogofilter.h"
#include "bogohist.h"
@@ -468,11 +466,11 @@
progname, version);
}
-char *ds_file = NULL;
-bool prob = false;
+static char *ds_file = NULL;
+static bool prob = false;
typedef enum { M_NONE, M_DUMP, M_LOAD, M_WORD, M_MAINTAIN, M_ROBX, M_HIST } cmd_t;
-cmd_t flag = M_NONE;
+static cmd_t flag = M_NONE;
#ifndef ENABLE_DEPRECATED_CODE
#define OPTIONS ":a:c:d:DhH:I:k:l:m:np:r:R:s:vVw:x:X:y:"
Index: src/bogowordfreq.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/bogowordfreq.c,v
retrieving revision 1.10
diff -u -r1.10 bogowordfreq.c
--- src/bogowordfreq.c 15 Dec 2003 00:29:25 -0000 1.10
+++ src/bogowordfreq.c 30 Jan 2004 21:06:44 -0000
@@ -18,9 +18,11 @@
#include <stdlib.h>
#include <string.h>
+#include "bogoconfig.h"
#include "bogoreader.h"
#include "charset.h"
#include "collect.h"
+#include "degen.h"
#include "mime.h"
#include "wordhash.h"
#include "wordlists.h"
@@ -33,20 +35,23 @@
#endif
/* dummy function to satisfy reference in wordhash_degen() */
-void degen(word_t *token, wordcnts_t *cnts);
-void degen(word_t *token, wordcnts_t *cnts)
+double degen(const word_t *token, wordcnts_t *cnts)
{
- token = NULL; /* quiet compiler */
- cnts = NULL; /* quiet compiler */
- return;
+ (void)token;
+ (void)cnts;
+ return .0;
}
-/* function prototypes */
-
-void initialize(void);
-
/* function definitions */
+static void initialize(void)
+{
+ init_charset_table(charset_default, true);
+ mime_reset();
+ token_init();
+ lexer_v3_init(NULL);
+}
+
static void print_wordlist (wordhash_t *h)
{
hashnode_t *n;
@@ -87,10 +92,3 @@
return 0;
}
-void initialize()
-{
- init_charset_table(charset_default, true);
- mime_reset();
- token_init();
- lexer_v3_init(NULL);
-}
Index: src/common.h
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/common.h,v
retrieving revision 1.42
diff -u -r1.42 common.h
--- src/common.h 25 Jan 2004 20:55:39 -0000 1.42
+++ src/common.h 30 Jan 2004 21:06:44 -0000
@@ -10,6 +10,8 @@
#ifndef COMMON_H
#define COMMON_H
+#define __USE_BSD 1
+
#ifndef CONFIG_H
# define CONFIG_H
# include "config.h"
@@ -19,6 +21,7 @@
# include "bftypes.h"
#endif
+#include <stdarg.h>
#include <stdio.h>
#if defined(HAVE_LIMITS_H)
@@ -143,6 +146,10 @@
extern void bf_abort(void);
extern void bf_exit(void);
-#define internal_error do { fprintf(stderr, "Internal error in %s:%u\n", __FILE__, __LINE__); abort(); } while(0)
+/* getopt stuff */
+extern char *optarg;
+extern int optind, opterr, optopt;
+
+#define internal_error do { fprintf(stderr, "Internal error in %s:%lu\n", __FILE__, (unsigned long)__LINE__); abort(); } while(0)
#endif
Index: src/datastore.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/datastore.c,v
retrieving revision 1.23
diff -u -r1.23 datastore.c
--- src/datastore.c 26 Dec 2003 15:16:04 -0000 1.23
+++ src/datastore.c 30 Jan 2004 21:06:44 -0000
@@ -33,8 +33,7 @@
/* Function prototypes */
-void ds_init(void);
-void ds_cleanup(void);
+static void ds_init(void);
/* Function definitions */
@@ -207,14 +206,14 @@
case DS_NOTFOUND:
if (DEBUG_DATABASE(3)) {
fprintf(dbgout, "ds_read: [%.*s] not found\n",
- CLAMP_INT_MAX(word->leng), (char *) word->text);
+ CLAMP_INT_MAX(word->leng), word->text);
}
break;
default:
fprintf(dbgout, "ret=%d, DS_NOTFOUND=%d\n", ret, DS_NOTFOUND);
print_error(__FILE__, __LINE__, "ds_read( '%.*s' ), err: %d, %s",
- CLAMP_INT_MAX(word->leng), (char *) word->text, ret, db_str_err(ret));
+ CLAMP_INT_MAX(word->leng), word->text, ret, db_str_err(ret));
exit(EX_ERROR);
}
}
@@ -351,9 +350,9 @@
return ret;
}
-word_t *msg_count_tok;
+static word_t *msg_count_tok;
-void ds_init()
+static void ds_init()
{
if (msg_count_tok == NULL) {
msg_count_tok = word_new((const byte *)MSG_COUNT, strlen(MSG_COUNT));
Index: src/find_home_tildeexpand.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/find_home_tildeexpand.c,v
retrieving revision 1.5
diff -u -r1.5 find_home_tildeexpand.c
--- src/find_home_tildeexpand.c 29 Sep 2003 19:37:14 -0000 1.5
+++ src/find_home_tildeexpand.c 30 Jan 2004 21:06:44 -0000
@@ -25,9 +25,9 @@
#include "xstrdup.h"
#ifndef __riscos__
-bool tilde_expand = true;
+static bool tilde_expand = true;
#else
-bool tilde_expand = false;
+static bool tilde_expand = false;
#endif
/*
Index: src/fisher.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/fisher.c,v
retrieving revision 1.23
diff -u -r1.23 fisher.c
--- src/fisher.c 20 Jan 2004 12:55:17 -0000 1.23
+++ src/fisher.c 30 Jan 2004 21:06:44 -0000
@@ -43,7 +43,7 @@
extern double thresh_rtable; /* in robinson.c */
#endif
-const parm_desc fis_parm_table[] =
+static const parm_desc fis_parm_table[] =
{
{ "robx", CP_DOUBLE, { (void *) &robx } },
{ "robs", CP_DOUBLE, { (void *) &robs } },
Index: src/format.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/format.c,v
retrieving revision 1.29
diff -u -r1.29 format.c
--- src/format.c 19 Jan 2004 18:21:41 -0000 1.29
+++ src/format.c 30 Jan 2004 21:06:44 -0000
@@ -16,7 +16,7 @@
#include <stdlib.h>
#include <string.h>
-#if NEEDTRIO
+#ifdef NEEDTRIO
#include <trio.h>
#endif
@@ -37,10 +37,10 @@
/* uninitialized static variables */
-const char *reg = "";
-const char *unreg = "";
-uint wrdcount = 0;
-uint msgcount = 0;
+static const char *reg = "";
+static const char *unreg = "";
+static uint wrdcount = 0;
+static uint msgcount = 0;
/* initialized static variables */
Index: src/globals.h
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/globals.h,v
retrieving revision 1.53
diff -u -r1.53 globals.h
--- src/globals.h 25 Jan 2004 20:57:18 -0000 1.53
+++ src/globals.h 30 Jan 2004 21:06:44 -0000
@@ -39,6 +39,7 @@
#ifdef ENABLE_DEPRECATED_CODE
extern wl_t wl_mode; /* '-W' */
#endif
+extern bool replace_nonascii_characters; /* '-n' */
/* config file options */
extern int max_repeats;
@@ -91,6 +92,13 @@
extern u_int32_t msgs_good;
extern u_int32_t msgs_bad;
+/* for passthrough.c */
+extern size_t msg_register_size;
+extern char msg_register[256];
+
+extern bool maintain;
+extern bool onlyprint;
+
/* from html.h */
#ifndef ENABLE_DEPRECATED_CODE
#ifndef VER_017
Index: src/lexer.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/lexer.c,v
retrieving revision 1.86
diff -u -r1.86 lexer.c
--- src/lexer.c 8 Jan 2004 04:34:55 -0000 1.86
+++ src/lexer.c 30 Jan 2004 21:06:45 -0000
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include "base64.h"
+#include "bogoconfig.h"
#include "bogoreader.h"
#include "charset.h"
#include "error.h"
@@ -34,9 +35,7 @@
/* Local Variables */
-extern char *spam_header_name;
-
-lexer_t v3_lexer = {
+static lexer_t v3_lexer = {
lexer_v3_lex,
&lexer_v3_text,
&lexer_v3_leng
@@ -54,9 +53,6 @@
static int skip_folded_line(buff_t *buff);
/* Function Definitions */
-
-extern char yy_get_state(void);
-extern void yy_set_state_initial(void);
static void lexer_display_buffer(buff_t *buff)
{
@@ -149,11 +145,12 @@
}
}
- if (0) { /* debug */
- fprintf(dbgout, "%d: ", count);
- buff_puts(buff, 0, dbgout);
- fprintf(dbgout, "\n");
- }
+#if 0
+ /* debug */
+ fprintf(dbgout, "%d: ", count);
+ buff_puts(buff, 0, dbgout);
+ fprintf(dbgout, "\n");
+#endif
if ( !msg_header && msg_state->mime_type != MIME_TYPE_UNKNOWN)
{
@@ -186,7 +183,7 @@
static int skip_folded_line(buff_t *buff)
{
- while (true) {
+ for(;;) {
int count;
buff->t.leng = 0;
count = reader_getline(buff);
@@ -195,9 +192,9 @@
return count;
}
- return EOF;
+/* return EOF; */
}
-
+
int buff_fill(buff_t *buff, size_t used, size_t need)
{
int cnt = 0;
Index: src/lexer.h
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/lexer.h,v
retrieving revision 1.32
diff -u -r1.32 lexer.h
--- src/lexer.h 31 Oct 2003 10:55:53 -0000 1.32
+++ src/lexer.h 30 Jan 2004 21:06:45 -0000
@@ -60,12 +60,17 @@
extern char * lexer_v3_text;
extern void lexer_v3_init(FILE *fp);
+
/* in lexer_v4.l */
extern token_t lexer_v4_lex(void);
extern int lexer_v4_leng;
extern char * lexer_v4_text;
extern void lexer_v4_init(FILE *fp);
+/* in lexer_v?.c */
+extern char yy_get_state(void);
+extern void yy_set_state_initial(void);
+
/* in lexer.c */
extern void yyinit(void);
extern int yyinput(byte *buf, size_t size);
Index: src/main.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/main.c,v
retrieving revision 1.81
diff -u -r1.81 main.c
--- src/main.c 22 Jan 2004 02:13:16 -0000 1.81
+++ src/main.c 30 Jan 2004 21:06:45 -0000
@@ -19,8 +19,6 @@
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
-extern char *optarg;
-extern int optind, opterr, optopt;
#include "bogoconfig.h"
#include "bogofilter.h"
Index: src/method.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/method.c,v
retrieving revision 1.4
diff -u -r1.4 method.c
--- src/method.c 1 Aug 2003 00:30:12 -0000 1.4
+++ src/method.c 30 Jan 2004 21:06:45 -0000
@@ -33,8 +33,6 @@
stats_t *mth_stats;
-extern double min_dev;
-
void mth_initialize(void *s, int _max_repeats, double _min_dev, double _spam_cutoff, double _good_weight)
{
mth_stats = (stats_t *) s;
Index: src/mime.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/mime.c,v
retrieving revision 1.22
diff -u -r1.22 mime.c
--- src/mime.c 31 Oct 2003 15:34:53 -0000 1.22
+++ src/mime.c 30 Jan 2004 21:06:45 -0000
@@ -37,13 +37,13 @@
/* Global Variables */
-int stackp = -1;
+static int stackp = -1;
-mime_t msg_stack[MIME_STACK_MAX];
+static mime_t msg_stack[MIME_STACK_MAX];
mime_t *msg_state = msg_stack;
mime_t *msg_top = msg_stack;
-struct type_s
+static struct type_s
{
enum mimetype type;
const char *name;
@@ -60,7 +60,7 @@
{ MIME_MULTIPART, "multipart/", 10, } ,
};
-struct encoding_s
+static struct encoding_s
{
enum mimeencoding encoding;
const char *name;
@@ -75,7 +75,7 @@
{ MIME_UUENCODE, "X-UUENCODE", } ,
};
-struct disposition_s
+static struct disposition_s
{
enum mimedisposition disposition;
const char *name;
Index: src/msgcounts.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/msgcounts.c,v
retrieving revision 1.25
diff -u -r1.25 msgcounts.c
--- src/msgcounts.c 4 Jan 2004 20:52:06 -0000 1.25
+++ src/msgcounts.c 30 Jan 2004 21:06:45 -0000
@@ -22,12 +22,12 @@
/* Globals */
-char msg_count_buff[MSG_COUNT_MAX_LEN];
+static char msg_count_buff[MSG_COUNT_MAX_LEN];
int msg_count_leng = MSG_COUNT_MAX_LEN; /* DO NOT MAKE THIS SIZE_T! */
char *msg_count_text = msg_count_buff;
-const char *msg_count_header = "\"" MSG_COUNT "\" ";
-size_t msg_count_header_len = 0;
+static const char *msg_count_header = "\"" MSG_COUNT "\" ";
+static size_t msg_count_header_len = 0;
u_int32_t msgs_good = 0L;
u_int32_t msgs_bad = 0L;
Index: src/passthrough.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/passthrough.c,v
retrieving revision 1.21
diff -u -r1.21 passthrough.c
--- src/passthrough.c 19 Jan 2004 18:21:41 -0000 1.21
+++ src/passthrough.c 30 Jan 2004 21:06:45 -0000
@@ -27,8 +27,8 @@
FILE *fpo;
char msg_register[256];
-char msg_bogofilter[256];
-char msg_spam_header[256];
+static char msg_bogofilter[256];
+static char msg_spam_header[256];
size_t msg_register_size = sizeof(msg_register);
/* Function Definitions */
Index: src/paths.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/paths.c,v
retrieving revision 1.18
diff -u -r1.18 paths.c
--- src/paths.c 27 Dec 2003 16:33:40 -0000 1.18
+++ src/paths.c 30 Jan 2004 21:06:46 -0000
@@ -25,7 +25,7 @@
const char *s; /* sub dir */
} pri_2_env_t;
-pri_2_env_t pri_2_env[] = {
+static pri_2_env_t pri_2_env[] = {
#ifndef __riscos__
{ PR_ENV_BOGO, "BOGOFILTER_DIR", NULL },
{ PR_ENV_BOGO, "BOGODIR", NULL },
Index: src/register.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/register.c,v
retrieving revision 1.24
diff -u -r1.24 register.c
--- src/register.c 31 Oct 2003 14:52:25 -0000 1.24
+++ src/register.c 30 Jan 2004 21:06:46 -0000
@@ -16,9 +16,6 @@
#define PLURAL(count) ((count == 1) ? "" : "s")
-extern char msg_register[];
-extern size_t msg_register_size;
-
/*
* tokenize text on stdin and register it to a specified list
* and possibly out of another list
Index: src/robinson.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/robinson.c,v
retrieving revision 1.70
diff -u -r1.70 robinson.c
--- src/robinson.c 20 Jan 2004 12:55:17 -0000 1.70
+++ src/robinson.c 30 Jan 2004 21:06:46 -0000
@@ -27,8 +27,6 @@
#include "wordhash.h"
#include "wordlists.h"
-extern int Rtable;
-
#ifdef ENABLE_DEPRECATED_CODE
double thresh_rtable = 0.0; /* used in fisher.c */
#endif
Index: src/rstats.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/rstats.c,v
retrieving revision 1.35
diff -u -r1.35 rstats.c
--- src/rstats.c 28 Dec 2003 18:25:34 -0000 1.35
+++ src/rstats.c 30 Jan 2004 21:06:46 -0000
@@ -24,12 +24,6 @@
#include "rstats.h"
#include "xmalloc.h"
-extern int Rtable;
-extern double min_dev;
-
-extern double robx; /* from robinson.c */
-extern double robs; /* from robinson.c */
-
typedef struct rstats_s rstats_t;
struct rstats_s {
rstats_t *next;
Index: src/textblock.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/textblock.c,v
retrieving revision 1.7
diff -u -r1.7 textblock.c
--- src/textblock.c 22 Aug 2003 18:33:15 -0000 1.7
+++ src/textblock.c 30 Jan 2004 21:06:46 -0000
@@ -16,7 +16,7 @@
static textblock_t *textblocks = NULL;
-size_t cur_mem, max_mem, tot_mem;
+static size_t cur_mem, max_mem, tot_mem;
/* Function Definitions */
Index: src/wordhash.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/wordhash.c,v
retrieving revision 1.39
diff -u -r1.39 wordhash.c
--- src/wordhash.c 4 Jan 2004 23:24:59 -0000 1.39
+++ src/wordhash.c 30 Jan 2004 21:06:47 -0000
@@ -57,12 +57,11 @@
/* global variables */
/* for bogotune */
-wordhash_t *memory_db;
+static wordhash_t *memory_db;
/* function prototypes */
-void wh_trap(void);
-void wh_trap(void) {}
+static void wh_trap(void) {}
/* function definitions */
Index: src/wordhash.main.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/wordhash.main.c,v
retrieving revision 1.7
diff -u -r1.7 wordhash.main.c
--- src/wordhash.main.c 15 Dec 2003 00:29:25 -0000 1.7
+++ src/wordhash.main.c 30 Jan 2004 21:06:47 -0000
@@ -2,6 +2,7 @@
#include "common.h"
+#include "degen.h"
#include "wordhash.h"
typedef struct
@@ -11,12 +12,11 @@
wh_elt_t;
/* dummy function to satisfy reference in wordhash_degen() */
-void degen(word_t *token, wordcnts_t *cnts);
-void degen(word_t *token, wordcnts_t *cnts)
+double degen(const word_t *token, wordcnts_t *cnts)
{
- token = NULL; /* quiet compiler */
- cnts = NULL; /* quiet compiler */
- return;
+ (void)token;
+ (void)cnts;
+ return .0;
}
/* function definitions */
@@ -26,9 +26,7 @@
w->count = 0;
}
-void dump_hash (wordhash_t *);
-
-void
+static void
dump_hash (wordhash_t * h)
{
hashnode_t *p;
Index: src/wordlists.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/wordlists.c,v
retrieving revision 1.45
diff -u -r1.45 wordlists.c
--- src/wordlists.c 1 Jan 2004 13:34:50 -0000 1.45
+++ src/wordlists.c 30 Jan 2004 21:06:47 -0000
@@ -22,9 +22,6 @@
#define MIN_SLEEP 0.5e+3 /* 0.5 milliseconds */
#define MAX_SLEEP 2.0e+6 /* 2.0 seconds */
-wordlist_t *good_list;
-wordlist_t *spam_list;
-
/* Function Prototypes */
static void rand_sleep(double min, double max);
More information about the bogofilter-dev
mailing list