Changeset e187445


Ignore:
Timestamp:
Jun 22, 2003, 1:40:49 PM (17 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
53f421b
Parents:
a6560fe
Message:
reformatted filter, filterelement and regex to new code style
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • filter.c

    r0c502e9 re187445  
    44static const char fileIdent[] = "$Id$";
    55
    6 int owl_filter_init_fromstring(owl_filter *f, char *name, char *string) {
     6int owl_filter_init_fromstring(owl_filter *f, char *name, char *string)
     7{
    78  char **argv;
    89  int argc, out;
     
    1415}
    1516
    16 int owl_filter_init(owl_filter *f, char *name, int argc, char **argv) {
     17int owl_filter_init(owl_filter *f, char *name, int argc, char **argv)
     18{
    1719  int i, error;
    1820  owl_filterelement *fe;
     
    8890}
    8991
    90 char *owl_filter_get_name(owl_filter *f) {
     92char *owl_filter_get_name(owl_filter *f)
     93{
    9194  return(f->name);
    9295}
    9396
    94 void owl_filter_set_polarity_match(owl_filter *f) {
     97void owl_filter_set_polarity_match(owl_filter *f)
     98{
    9599  f->polarity=0;
    96100}
    97101
    98 void owl_filter_set_polarity_unmatch(owl_filter *f) {
     102void owl_filter_set_polarity_unmatch(owl_filter *f)
     103{
    99104  f->polarity=1;
    100105}
    101106
    102 void owl_filter_set_color(owl_filter *f, int color) {
     107void owl_filter_set_color(owl_filter *f, int color)
     108{
    103109  f->color=color;
    104110}
    105111
    106 int owl_filter_get_color(owl_filter *f) {
     112int owl_filter_get_color(owl_filter *f)
     113{
    107114  return(f->color);
    108115}
    109116
    110 void owl_filter_set_cachedmsgid(owl_filter *f, int cachedmsgid) {
     117void owl_filter_set_cachedmsgid(owl_filter *f, int cachedmsgid)
     118{
    111119  f->cachedmsgid=cachedmsgid;
    112120}
    113121
    114 int owl_filter_get_cachedmsgid(owl_filter *f) {
     122int owl_filter_get_cachedmsgid(owl_filter *f)
     123{
    115124  return(f->cachedmsgid);
    116125}
    117126
    118 int owl_filter_message_match(owl_filter *f, owl_message *m) {
     127int owl_filter_message_match(owl_filter *f, owl_message *m)
     128{
    119129  int i, j, tmp;
    120130  owl_list work_fes, *fes;
     
    205215}
    206216
    207 int _owl_filter_message_match_recurse(owl_filter *f, owl_message *m, owl_list *fes, int start, int end) {
     217int _owl_filter_message_match_recurse(owl_filter *f, owl_message *m, owl_list *fes, int start, int end)
     218{
    208219  int a=0, b=0, i, x, y, z, score, ret, type;
    209220  owl_filterelement *fe, *tmpfe=NULL;
     
    357368}
    358369
    359 void owl_filter_print(owl_filter *f, char *out) {
     370void owl_filter_print(owl_filter *f, char *out)
     371{
    360372  int i, j;
    361373  owl_filterelement *fe;
     
    381393}
    382394
    383 int owl_filter_equiv(owl_filter *a, owl_filter *b) {
     395int owl_filter_equiv(owl_filter *a, owl_filter *b)
     396{
    384397  char buff[LINE], buff2[LINE];
    385398
     
    391404}
    392405
    393 void owl_filter_free(owl_filter *f) {
     406void owl_filter_free(owl_filter *f)
     407{
    394408  void (*func)();
    395409
  • filterelement.c

    r1aee7d9 re187445  
    1414
    1515
    16 void owl_filterelement_create_null(owl_filterelement *fe) {
     16void owl_filterelement_create_null(owl_filterelement *fe)
     17{
    1718  fe->type=OWL_FILTERELEMENT_NULL;
    1819  fe->field=NULL;
    1920}
    2021
    21 void owl_filterelement_create_openbrace(owl_filterelement *fe) {
     22void owl_filterelement_create_openbrace(owl_filterelement *fe)
     23{
    2224  fe->type=OWL_FILTERELEMENT_OPENBRACE;
    2325  fe->field=NULL;
    2426}
    2527
    26 void owl_filterelement_create_closebrace(owl_filterelement *fe) {
     28void owl_filterelement_create_closebrace(owl_filterelement *fe)
     29{
    2730  fe->type=OWL_FILTERELEMENT_CLOSEBRACE;
    2831  fe->field=NULL;
    2932}
    3033
    31 void owl_filterelement_create_and(owl_filterelement *fe) {
     34void owl_filterelement_create_and(owl_filterelement *fe)
     35{
    3236  fe->type=OWL_FILTERELEMENT_AND;
    3337  fe->field=NULL;
    3438}
    3539
    36 void owl_filterelement_create_or(owl_filterelement *fe) {
     40void owl_filterelement_create_or(owl_filterelement *fe)
     41{
    3742  fe->type=OWL_FILTERELEMENT_OR;
    3843  fe->field=NULL;
    3944}
    4045
    41 void owl_filterelement_create_not(owl_filterelement *fe) {
     46void owl_filterelement_create_not(owl_filterelement *fe)
     47{
    4248  fe->type=OWL_FILTERELEMENT_NOT;
    4349  fe->field=NULL;
    4450}
    4551
    46 void owl_filterelement_create_true(owl_filterelement *fe) {
     52void owl_filterelement_create_true(owl_filterelement *fe)
     53{
    4754  fe->type=OWL_FILTERELEMENT_TRUE;
    4855  fe->field=NULL;
    4956}
    5057
    51 void owl_filterelement_create_false(owl_filterelement *fe) {
     58void owl_filterelement_create_false(owl_filterelement *fe)
     59{
    5260  fe->type=OWL_FILTERELEMENT_FALSE;
    5361  fe->field=NULL;
    5462}
    5563
    56 void owl_filterelement_create_re(owl_filterelement *fe, char *field, char *re) {
     64void owl_filterelement_create_re(owl_filterelement *fe, char *field, char *re)
     65{
    5766  fe->type=OWL_FILTERELEMENT_RE;
    5867  fe->field=owl_strdup(field);
     
    6069}
    6170
    62 void owl_filterelement_free(owl_filterelement *fe) {
     71void owl_filterelement_free(owl_filterelement *fe)
     72{
    6373  if (fe->field) owl_free(fe->field);
    6474}
    6575
    66 int owl_filterelement_is_null(owl_filterelement *fe) {
     76int owl_filterelement_is_null(owl_filterelement *fe)
     77{
    6778  if (fe->type==OWL_FILTERELEMENT_NULL) return(1);
    6879  return(0);
    6980}
    7081
    71 int owl_filterelement_is_openbrace(owl_filterelement *fe) {
     82int owl_filterelement_is_openbrace(owl_filterelement *fe)
     83{
    7284  if (fe->type==OWL_FILTERELEMENT_OPENBRACE) return(1);
    7385  return(0);
    7486}
    7587
    76 int owl_filterelement_is_closebrace(owl_filterelement *fe) {
     88int owl_filterelement_is_closebrace(owl_filterelement *fe)
     89{
    7790  if (fe->type==OWL_FILTERELEMENT_CLOSEBRACE) return(1);
    7891  return(0);
    7992}
    8093
    81 int owl_filterelement_is_and(owl_filterelement *fe) {
     94int owl_filterelement_is_and(owl_filterelement *fe)
     95{
    8296  if (fe->type==OWL_FILTERELEMENT_AND) return(1);
    8397  return(0);
    8498}
    8599
    86 int owl_filterelement_is_or(owl_filterelement *fe) {
     100int owl_filterelement_is_or(owl_filterelement *fe)
     101{
    87102  if (fe->type==OWL_FILTERELEMENT_OR) return(1);
    88103  return(0);
    89104}
    90105
    91 int owl_filterelement_is_not(owl_filterelement *fe) {
     106int owl_filterelement_is_not(owl_filterelement *fe)
     107{
    92108  if (fe->type==OWL_FILTERELEMENT_NOT) return(1);
    93109  return(0);
    94110}
    95111
    96 int owl_filterelement_is_true(owl_filterelement *fe) {
     112int owl_filterelement_is_true(owl_filterelement *fe)
     113{
    97114  if (fe->type==OWL_FILTERELEMENT_TRUE) return(1);
    98115  return(0);
    99116}
    100117
    101 int owl_filterelement_is_false(owl_filterelement *fe) {
     118int owl_filterelement_is_false(owl_filterelement *fe)
     119{
    102120  if (fe->type==OWL_FILTERELEMENT_FALSE) return(1);
    103121  return(0);
    104122}
    105123
    106 int owl_filterelement_is_re(owl_filterelement *fe) {
     124int owl_filterelement_is_re(owl_filterelement *fe)
     125{
    107126  if (fe->type==OWL_FILTERELEMENT_RE) return(1);
    108127  return(0);
    109128}
    110129
    111 owl_regex *owl_filterelement_get_re(owl_filterelement *fe) {
     130owl_regex *owl_filterelement_get_re(owl_filterelement *fe)
     131{
    112132  return(&(fe->re));
    113133}
    114134
    115 char *owl_filterelement_get_field(owl_filterelement *fe) {
     135char *owl_filterelement_get_field(owl_filterelement *fe)
     136{
    116137  return(fe->field);
    117138}
    118139
    119 int owl_filterelement_is_value(owl_filterelement *fe) {
     140int owl_filterelement_is_value(owl_filterelement *fe)
     141{
    120142  if ( (fe->type==OWL_FILTERELEMENT_TRUE) ||
    121143       (fe->type==OWL_FILTERELEMENT_FALSE) ||
     
    127149
    128150
    129 char *owl_filterelement_to_string(owl_filterelement *fe) {
     151char *owl_filterelement_to_string(owl_filterelement *fe)
     152{
    130153  /* return must be freed by caller */
    131154 
  • regex.c

    ra6560fe re187445  
    44static const char fileIdent[] = "$Id$";
    55
    6 void owl_regex_init(owl_regex *re) {
     6void owl_regex_init(owl_regex *re)
     7{
    78  re->negate=0;
    89  re->string=NULL;
    910}
    1011
    11 int owl_regex_create(owl_regex *re, char *string) {
     12int owl_regex_create(owl_regex *re, char *string)
     13{
    1214  int ret;
    1315  char buff1[LINE], buff2[LINE];
     
    3739}
    3840
    39 int owl_regex_compare(owl_regex *re, char *string) {
     41int owl_regex_compare(owl_regex *re, char *string)
     42{
    4043  int out, ret;
    4144
     
    5356}
    5457
    55 int owl_regex_is_set(owl_regex *re) {
     58int owl_regex_is_set(owl_regex *re)
     59{
    5660  if (re->string) return(1);
    5761  return(0);
    5862}
    5963
    60 char *owl_regex_get_string(owl_regex *re) {
     64char *owl_regex_get_string(owl_regex *re)
     65{
    6166  return(re->string);
    6267}
    6368
    64 void owl_regex_copy(owl_regex *a, owl_regex *b) {
     69void owl_regex_copy(owl_regex *a, owl_regex *b)
     70{
    6571  b->negate=a->negate;
    6672  b->string=owl_strdup(a->string);
     
    6874}
    6975
    70 void owl_regex_free(owl_regex *re) {
     76void owl_regex_free(owl_regex *re)
     77{
    7178  if (re->string) owl_free(re->string);
    7279
Note: See TracChangeset for help on using the changeset viewer.