[cvs] bogofilter datastore_db.c,1.35,1.36
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2002-12-19 22:27:30
|
Update of /cvsroot/bogofilter/bogofilter In directory sc8-pr-cvs1:/tmp/cvs-serv30986 Modified Files: datastore_db.c Log Message: Switch to print_error, PRINT_ERROR is not portable. Index: datastore_db.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/datastore_db.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- datastore_db.c 17 Dec 2002 05:14:34 -0000 1.35 +++ datastore_db.c 19 Dec 2002 22:27:27 -0000 1.36 @@ -45,10 +45,10 @@ /* Function definitions */ static void db_enforce_locking(dbh_t *handle, const char *func_name){ - if (handle->locked == false){ - PRINT_ERROR("%s (%s): Attempt to access unlocked handle.", func_name, handle->name ); - exit(2); - } + if (handle->locked == false){ + print_error(__FILE__, __LINE__, "%s (%s): Attempt to access unlocked handle.", func_name, handle->name); + exit(2); + } } /* stolen from glibc's byteswap.c */ @@ -95,11 +95,11 @@ handle = dbh_init(db_file, name); if ((ret = db_create (&(handle->dbp), NULL, 0)) != 0){ - PRINT_ERROR("(db) create, err: %d, %s", ret, db_strerror(ret)); + print_error(__FILE__, __LINE__, "(db) create, err: %d, %s", ret, db_strerror(ret)); } else if ((ret = DB_OPEN(handle->dbp, db_file, NULL, DB_BTREE, opt_flags, 0664)) != 0) { - PRINT_ERROR("(db) open( %s ), err: %d, %s", db_file, ret, db_strerror(ret)); + print_error(__FILE__, __LINE__, "(db) open( %s ), err: %d, %s", db_file, ret, db_strerror(ret)); } else { /* see if the database byte order differs from that of the cpu's */ @@ -193,7 +193,7 @@ } return ret; default: - PRINT_ERROR("(db) db_getvalue( '%s' ), err: %d, %s", word, ret, db_strerror(ret)); + print_error(__FILE__, __LINE__, "(db) db_getvalue( '%s' ), err: %d, %s", word, ret, db_strerror(ret)); exit(2); } } @@ -254,7 +254,7 @@ } } else { - PRINT_ERROR("(db) db_set_dbvalue( '%s' ), err: %d, %s", word, ret, db_strerror(ret)); + print_error(__FILE__, __LINE__, "(db) db_set_dbvalue( '%s' ), err: %d, %s", word, ret, db_strerror(ret)); exit(2); } } @@ -323,7 +323,7 @@ struct flock lock; if ( (ret = handle->dbp->fd(handle->dbp, &fd)) != 0){ - PRINT_ERROR("(db) db_lock: %d, err: %d, %s", cmd, ret, db_strerror(ret)); + print_error(__FILE__, __LINE__, "(db) db_lock: %d, err: %d, %s", cmd, ret, db_strerror(ret)); exit(2); } @@ -351,7 +351,7 @@ fprintf(stderr, "[%lu] Faked read lock on %s.\n", (unsigned long) handle->pid, handle->filename); } else { - PRINT_ERROR( "Error acquiring read lock on %s\n", handle->filename); + print_error(__FILE__, __LINE__, "Error acquiring read lock on %s\n", handle->filename); exit(2); } } @@ -372,7 +372,7 @@ fprintf(stderr, "[%lu] Acquiring write lock on %s\n", (unsigned long) handle->pid, handle->filename); if (db_lock(handle, F_SETLKW, F_WRLCK) != 0){ - PRINT_ERROR( "Error acquiring write lock on %s\n", handle->filename); + print_error(__FILE__, __LINE__, "Error acquiring write lock on %s\n", handle->filename); exit(2); } @@ -393,7 +393,7 @@ fprintf(stderr, "[%lu] Releasing lock on %s\n", (unsigned long) handle->pid, handle->filename); if (db_lock(handle, F_SETLK, F_UNLCK) != 0){ - PRINT_ERROR( "Error releasing on %s\n", handle->filename); + print_error(__FILE__, __LINE__, "Error releasing on %s\n", handle->filename); exit(2); } } @@ -421,7 +421,7 @@ const char *block_type[] = { "nonblocking", "blocking" }; const char *lock_type[] = { "write", "read" }; - PRINT_ERROR("[%lu] [%d] %s %s %s lock on %s", + print_error(__FILE__, __LINE__, "[%lu] [%d] %s %s %s lock on %s", (unsigned long)handle->pid, idx, msg, |