Changeset ad15610 for filter.c


Ignore:
Timestamp:
Aug 8, 2007, 6:01:51 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
ce7b824
Parents:
b51d257
Message:
Applying ctl's variable shuffling patch for better ANSI C-ness. closes #18
File:
1 edited

Legend:

Unmodified
Added
Removed
  • filter.c

    r535d68b rad15610  
    6363static owl_filterelement * owl_filter_parse_primitive_expression(int argc, char **argv, int *next)
    6464{
     65  owl_filterelement *fe, *op;
     66  int i = 0, skip;
     67
    6568  if(!argc) return NULL;
    6669
    67   owl_filterelement * fe = owl_malloc(sizeof(owl_filterelement));
    68   owl_filterelement *op;
    69 
     70  fe = owl_malloc(sizeof(owl_filterelement));
    7071  owl_filterelement_create(fe);
    71   int i = 0, skip;
    7272
    7373  if(!strcasecmp(argv[i], "(")) {
     
    118118{
    119119  int i = 0, skip;
    120   owl_filterelement * op1 = NULL, * op2 = NULL;
     120  owl_filterelement * op1 = NULL, * op2 = NULL, *tmp;
    121121
    122122  op1 = owl_filter_parse_primitive_expression(argc-i, argv+i, &skip);
     
    129129    op2 = owl_filter_parse_primitive_expression(argc-i-1, argv+i+1, &skip);
    130130    if(!op2) goto err;
    131     owl_filterelement * tmp = owl_malloc(sizeof(owl_filterelement));
     131    tmp = owl_malloc(sizeof(owl_filterelement));
    132132    if(!strcasecmp(argv[i], "and")) {
    133133      owl_filterelement_create_and(tmp, op1, op2);
     
    204204int owl_filter_message_match(owl_filter *f, owl_message *m)
    205205{
     206  int ret;
    206207  if(!f->root) return 0;
    207   int ret = owl_filterelement_match(f->root, m);
     208  ret = owl_filterelement_match(f->root, m);
    208209  if(f->polarity) ret = !ret;
    209210  return ret;
     
    305306
    306307int owl_filter_regtest(void) {
    307   owl_list_create(&(g.filterlist));
    308308  int numfailed=0;
    309309  owl_message m;
     310  owl_filter f1, f2, f3, f4;
     311
     312  owl_list_create(&(g.filterlist));
    310313  owl_message_init(&m);
    311314  owl_message_set_type_zephyr(&m);
     
    345348  TEST_FILTER("true and false or false", 0);
    346349
    347   owl_filter f1, f2, f3, f4;
    348 
    349350  owl_filter_init_fromstring(&f1, "f1", "class owl");
    350351  owl_global_add_filter(&g, &f1);
Note: See TracChangeset for help on using the changeset viewer.