Show
Ignore:
Timestamp:
09/22/08 00:08:00 (4 months ago)
Author:
karpet
Message:

get rid of the circular reference in TokenList/Token?; make swish_init() a separate call from swish_init_swish3() so it can be called as class method rather than once-per-object; clean up some ref_cnt logic and mem debugging

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libswish3/trunk/src/libswish3/swish.c

    r2170 r2171  
    3131{ 
    3232    swish_3 *s3; 
    33     swish_init(); 
    3433    s3 = swish_xmalloc(sizeof(swish_3)); 
    3534    s3->ref_cnt = 0; 
     
    5453    swish_3 *s3 
    5554) 
    56 
    57     boolean children_are_freed; 
    58      
    59     children_are_freed = 0; 
     55{     
    6056    s3->parser->ref_cnt--; 
    6157    if (s3->parser->ref_cnt < 1) { 
    6258        swish_free_parser(s3->parser); 
    63         children_are_freed++; 
    6459    } 
    6560 
     
    6762    if (s3->analyzer->ref_cnt < 1) { 
    6863        swish_free_analyzer(s3->analyzer); 
    69         children_are_freed++; 
    7064    } 
    7165 
     
    7367    if (s3->config->ref_cnt < 1) { 
    7468        swish_free_config(s3->config); 
    75         children_are_freed++; 
    7669    } 
    7770 
     
    8073    } 
    8174    swish_xfree(s3); 
    82      
    83     if (children_are_freed == 3) { 
    84         swish_mem_debug(); 
    85     } 
    8675} 
    8776 
     77/* MUST call this before instantiating any swish_3 objects */ 
    8878void 
    8979swish_init(