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

all tests passing, all (known) leaks fixed

Files:

Legend:

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

    r2175 r2176  
    454454     
    455455    if (SWISH_DEBUG & SWISH_DEBUG_MEMORY) { 
    456         SWISH_DEBUG_MSG("freeing Token %d with MetaName ref_cnt %d",  
    457             t, t->meta->ref_cnt); 
     456        SWISH_DEBUG_MSG("freeing Token 0x%x with MetaName ref_cnt %d",  
     457            (long int)t, t->meta->ref_cnt); 
    458458    } 
    459459     
     
    502502swish_TokenIterator * 
    503503swish_init_token_iterator( 
    504     swish_3 *s3 
     504    swish_Analyzer *a 
    505505) 
    506506{ 
    507507    swish_TokenIterator *it; 
    508508    it = swish_xmalloc(sizeof(swish_TokenIterator)); 
    509     it->s3 = s3
    510     it->s3->ref_cnt++; 
     509    it->a = a
     510    it->a->ref_cnt++; 
    511511    it->pos = 0; 
    512512    it->tl = swish_init_token_list(); 
     
    527527    if (SWISH_DEBUG & SWISH_DEBUG_MEMORY) { 
    528528        SWISH_DEBUG_MSG( 
    529         "freeing TokenIterator %d with TokenList ref_cnt %d and s3 ref_cnt %d",  
    530         it, it->tl->ref_cnt, it->s3->ref_cnt); 
    531     } 
    532      
    533     it->s3->ref_cnt--; 
     529        "freeing TokenIterator %d with TokenList ref_cnt %d and Analyzer ref_cnt %d",  
     530        it, it->tl->ref_cnt, it->a->ref_cnt); 
     531    } 
     532     
     533    it->a->ref_cnt--; 
     534    if (SWISH_DEBUG & SWISH_DEBUG_MEMORY) { 
     535        SWISH_DEBUG_MSG("freeing TokenIterator with Analyzer ref_cnt = %d", 
     536            it->a->ref_cnt); 
     537    } 
     538    if (it->a->ref_cnt == 0) 
     539        swish_free_analyzer(it->a); 
    534540         
    535541    it->tl->ref_cnt--; 
     
    589595     
    590596    tl          = ti->tl; 
    591     maxwordlen      = ti->s3->analyzer->maxwordlen; 
    592     minwordlen      = ti->s3->analyzer->minwordlen; 
     597    maxwordlen      = ti->a->maxwordlen; 
     598    minwordlen      = ti->a->minwordlen; 
    593599    token       = swish_xmalloc(sizeof(xmlChar) * maxwordlen); 
    594600    buf_lower   = swish_utf8_str_tolower(buf); 
     
    796802     
    797803    tl              = ti->tl; 
    798     maxwordlen      = ti->s3->analyzer->maxwordlen; 
    799     minwordlen      = ti->s3->analyzer->minwordlen; 
     804    maxwordlen      = ti->a->maxwordlen; 
     805    minwordlen      = ti->a->minwordlen; 
    800806    token           = swish_xmalloc(sizeof(xmlChar) * maxwordlen); 
    801807    nstart          = tl->n;