Show
Ignore:
Timestamp:
09/26/08 23:59:57 (2 months ago)
Author:
karpet
Message:

some versions of html parser were passing through extra whitespace.
seems to be a specific libxml2 issue. in any case, added a new
whitespace check in both add to buf methods and perl bindings
(the latter where t/20-metanames.t was failing due to extra whitespace)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libswish3/trunk/bindings/perl/xs_helpers.c

    r2176 r2178  
    565565    int bump            = strlen(SWISH_TOKENPOS_BUMPER); 
    566566    int len; 
     567 
     568    //warn("%s nb_content: '%s'\n", key, str); 
    567569         
    568570    /* analogous to @strings = split(/SWISH_TOKENPOS_BUMPER/, str) */ 
    569571    while((tmp = xmlStrstr(str, (xmlChar*)SWISH_TOKENPOS_BUMPER)) != NULL) 
    570572    { 
     573        //warn("%s split: '%s'\n", key, str); 
    571574        len = tmp - str; 
    572         if(len) 
     575        if(len && !swish_str_all_ws_len((xmlChar*)str, len)) { 
    573576            av_push(strings, newSVpvn((char*)str, len)); 
    574              
     577        } 
    575578        str = tmp + bump;  /* move the pointer up */ 
    576579    } 
    577580     
    578581    /* no match and/or last match */ 
    579     if (!xmlStrstr(str, (xmlChar*)SWISH_TOKENPOS_BUMPER)) { 
     582    if ( !xmlStrstr(str, (xmlChar*)SWISH_TOKENPOS_BUMPER)  
     583      && strlen((char*)str)  
     584      && !swish_str_all_ws((xmlChar*)str) 
     585    ) { 
    580586        av_push(strings, newSVpvn((char*)str, strlen((char*)str))); 
    581587    }