Changeset 13

Show
Ignore:
Timestamp:
07/06/2006 11:54:07 (2 years ago)
Author:
why
Message:
  • ext/hpricot_scan/hpricot_scan.rl: the scanner was getting choked on some empty tokens. for some reason, news.bbc.co.uk had such issues.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ext/hpricot_scan/hpricot_scan.rl

    r6 r13  
    1313static ID s_read, s_to_str; 
    1414 
    15 #define ELE(N) rb_yield_tokens(sym_##N, tag, attr, tokstart == 0 ? Qnil : rb_str_new(tokstart, tokend-tokstart), taint); 
     15#define ELE(N) \ 
     16  if (tokend > tokstart) { \ 
     17    rb_yield_tokens(sym_##N, tag, attr, tokstart == 0 ? Qnil : rb_str_new(tokstart, tokend-tokstart), taint); \ 
     18  } 
    1619 
    1720#define SET(N, E) \ 
    1821  if (mark_##N == NULL) \ 
    1922    N = rb_str_new2(""); \ 
    20   else \ 
     23  else if (E > mark_##N) \ 
    2124    N = rb_str_new(mark_##N, E - mark_##N); 
    2225