~ubuntu-branches/ubuntu/precise/dspam/precise

« back to all changes in this revision

Viewing changes to src/diction.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Valroff, Julien Valroff, Thomas Preud'homme
  • Date: 2011-05-08 13:43:52 UTC
  • mfrom: (1.2.1 upstream) (8.2.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20110508134352-dxjx9m6tx1cbzlhq
Tags: 3.9.1~rc1+git20110419.29261fb+dfsg-1
[ Julien Valroff ]
* New git snapshot
* Install all dspam_* tools setgid so that they can be used by standard
  users
* Add symbols file for libdspam7
* Upload to unstable

[ Thomas Preud'homme ]
* Fix permissions on dspam_stats and missing opt-{in,out} directories
  (Closes: #394443)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: diction.c,v 1.10 2006/05/13 01:12:59 jonz Exp $ */
 
1
/* $Id: diction.c,v 1.14 2010/01/03 14:39:13 sbajic Exp $ */
2
2
 
3
3
/*
4
4
 DSPAM
5
 
 COPYRIGHT (C) 2002-2006 JONATHAN A. ZDZIARSKI
 
5
 COPYRIGHT (C) 2002-2010 DSPAM PROJECT
6
6
 
7
7
 This program is free software; you can redistribute it and/or
8
8
 modify it under the terms of the GNU General Public License
251
251
{
252
252
  unsigned long bucket;
253
253
  ds_term_t term;
 
254
  ds_term_t tbl_term;
254
255
 
255
256
  if (!cur)
256
257
    return NULL;
262
263
  }
263
264
 
264
265
  while (cur->iter_index < cur->diction->size) {
265
 
    bucket = cur->iter_index++;
266
 
    if (cur->diction->tbl[bucket]) {
267
 
      cur->iter_next = cur->diction->tbl[bucket]->next;
268
 
      return (cur->diction->tbl[bucket]);
 
266
    bucket = cur->iter_index;
 
267
    cur->iter_index++;
 
268
    tbl_term = cur->diction->tbl[bucket];
 
269
    if (tbl_term) {
 
270
      cur->iter_next = tbl_term->next;
 
271
      return (tbl_term);
269
272
    }
270
273
  }
271
274
 
289
292
    term->s.spam_hits = s->spam_hits;
290
293
    term->s.innocent_hits = s->innocent_hits;
291
294
    term->s.status = s->status;
 
295
    term->s.offset = s->offset;
292
296
    return 0;
293
297
  }
294
298
  return -1;
302
306
    term->s.probability += s->probability;
303
307
    term->s.spam_hits += s->spam_hits;
304
308
    term->s.innocent_hits += s->innocent_hits;
 
309
    if (!term->s.offset)
 
310
      term->s.offset = s->offset;
305
311
    if (s->status & TST_DISK)
306
312
      term->s.status |= TST_DISK;
307
313
    if (s->status & TST_DIRTY)
321
327
    s->spam_hits = term->s.spam_hits;
322
328
    s->innocent_hits = term->s.innocent_hits;
323
329
    s->status = term->s.status;
 
330
    s->offset = term->s.offset;
324
331
    return 0;
325
332
  }
326
333
  return -1;