Changeset ad15610


Ignore:
Timestamp:
Aug 8, 2007, 6:01:51 PM (17 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, 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
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    rb363d83 rad15610  
    24682468  owl_message *m;
    24692469  owl_view *v;
     2470  char *cmd;
    24702471
    24712472  v = owl_global_get_current_view(&g);
     
    24862487    return;
    24872488  }
    2488   char * cmd = owl_message_get_attribute_value(m, "yescommand");
     2489  cmd = owl_message_get_attribute_value(m, "yescommand");
    24892490  if(!cmd) {
    24902491    owl_function_error("No yes command!");
     
    25012502  owl_message *m;
    25022503  owl_view *v;
     2504  char *cmd;
    25032505
    25042506  v = owl_global_get_current_view(&g);
     
    25192521    return;
    25202522  }
    2521   char * cmd = owl_message_get_attribute_value(m, "nocommand");
     2523  cmd = owl_message_get_attribute_value(m, "nocommand");
    25222524  if(!cmd) {
    25232525    owl_function_error("No no command!");
  • 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);
  • functions.c

    r0ef0e8f rad15610  
    28012801  owl_message *m;
    28022802  char *zperson, *filtname=NULL;
     2803  char *argv[1];
    28032804 
    28042805  v=owl_global_get_current_view(&g);
     
    28592860
    28602861  /* pass it off to perl */
    2861   char *argv[1];
    28622862  if(type) {
    28632863    argv[0] = "-i";
  • global.c

    rb363d83 rad15610  
    1818  struct hostent *hent;
    1919  char hostname[MAXHOSTNAMELEN];
     20  char *cd;
    2021
    2122  g->malloced=0;
     
    8889  g->confdir = NULL;
    8990  g->startupfile = NULL;
    90   char * cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR);
     91  cd = owl_sprintf("%s/%s", g->homedir, OWL_CONFIG_DIR);
    9192  owl_global_set_confdir(g, cd);
    9293  owl_free(cd);
  • message.c

    r21f0a9d rad15610  
    2727owl_fmtext_cache * owl_message_next_fmtext() /*noproto*/
    2828{
     29    owl_fmtext_cache * f = fmtext_cache_next;
    2930    if(fmtext_cache_next->message != NULL) {
    3031        owl_message_invalidate_format(fmtext_cache_next->message);
    3132    }
    32     owl_fmtext_cache * f = fmtext_cache_next;
    3333    fmtext_cache_next++;
    3434    if(fmtext_cache_next - fmtext_cache == OWL_FMTEXT_CACHE_SIZE)
     
    567567
    568568int owl_message_is_answered(owl_message *m) {
     569  char *q;
    569570  if(!owl_message_is_question(m)) return 0;
    570   char * q = owl_message_get_attribute_value(m, "question");
     571  q = owl_message_get_attribute_value(m, "question");
    571572  if(!q) return 0;
    572573  return !strcmp(q, "answered");
  • perlconfig.c

    rf6b319c rad15610  
    137137  char *key,*val;
    138138  HV * hash;
     139  struct tm tm;
    139140
    140141  hash = (HV*)SvRV(msg);
     
    162163    } else if (!strcmp(key, "time")) {
    163164      m->timestr = owl_strdup(val);
    164       struct tm tm;
    165165      strptime(val, "%a %b %d %T %Y", &tm);
    166166      m->time = mktime(&tm);
     
    445445  int i, count;
    446446  char * ret = NULL;
     447  SV *rv;
    447448  STRLEN n_a;
    448449  dSP;
     
    467468    if(count != 1)
    468469      croak("Perl command %s returned more than one value!", cmd->name);
    469     SV * rv = POPs;
     470    rv = POPs;
    470471    if(SvTRUE(rv)) {
    471472      ret = owl_strdup(SvPV(rv, n_a));
     
    488489  SV *cb = (SV*)(e->cbdata);
    489490  unsigned int n_a;
     491  dSP;
     492
    490493  if(cb == NULL) {
    491494    owl_function_error("Perl callback is NULL!");
    492495  }
    493 
    494   dSP;
    495496
    496497  ENTER;
     
    516517void owl_perlconfig_mainloop()
    517518{
     519  dSP;
    518520  if (!owl_perlconfig_is_function("BarnOwl::Hooks::_mainloop_hook"))
    519521    return;
    520   dSP ;
    521522  PUSHMARK(SP) ;
    522523  call_pv("BarnOwl::Hooks::_mainloop_hook", G_DISCARD|G_EVAL);
  • variable.c

    r1cf3f8d3 rad15610  
    974974  int numfailed=0;
    975975  char buf[1024];
     976  owl_variable * v;
    976977
    977978  in_regtest = 1;
     
    10271028  FAIL_UNLESS("get enum 10", OWL_WEBBROWSER_NETSCAPE==owl_variable_get_int(&vd,"webbrowser"));
    10281029
    1029   owl_variable * v;
    1030  
    10311030  owl_variable_dict_newvar_string(&vd, "stringvar", "", "", "testval");
    10321031  FAIL_UNLESS("get new string var", NULL != (v = owl_variable_get(&vd, "stringvar", OWL_VARIABLE_STRING)));
Note: See TracChangeset for help on using the changeset viewer.