Mercurial > hg > Applications > Grep
diff regexParser/threadedSearch.cc @ 320:da02a7258d54
fix
author | mir3636 |
---|---|
date | Sun, 08 May 2016 23:31:14 +0900 |
parents | 7b8234c090f7 |
children | a1b65d39b947 |
line wrap: on
line diff
--- a/regexParser/threadedSearch.cc Sun May 08 22:53:20 2016 +0900 +++ b/regexParser/threadedSearch.cc Sun May 08 23:31:14 2016 +0900 @@ -7,6 +7,11 @@ #include "threadedSearch.h" #include "subsetConstruction.h" +#define max(a,b)((a)>(b)?a:b) +#define min(a,b)((a)<(b)?a:b) + +TStatePtr nextTState(BitVector bi,TransitionGeneratorPtr tg); + static TSValue stateNothing(TSValue tsv) { return tsv; @@ -25,9 +30,9 @@ long skip = tsv.tg->maxWordLen; for (int k = 0; k < tsv.current->ccvSize; k++) { CCVPtr ccv = &tsv.current->ccv[k]; - if (ccv.w.word) { - int i = ccv.w.length - 1; - while (tsv.buff.buffptr[i] == ccv.w.word[i]) { + if (ccv->w.word) { + int i = ccv->w.length - 1; + while (tsv.buff.buffptr[i] == ccv->w.word[i]) { if (i == 0) { if (ccv->tState) { tsv.current = ccv->tState; @@ -35,12 +40,12 @@ tsv.current = nextTState(ccv->state,tsv.tg); ccv->tState = tsv.current; } - tsv.buff.buffptr += ccv.w.length - 1; + tsv.buff.buffptr += ccv->w.length - 1; return tsv; } --i; } - skip = min(skip,max(ccv.w.bm->skip[tsv.buff.buffptr[i]],ccv.w.length - i)); + skip = min(skip,max(ccv->w.bm->skip_table[tsv.buff.buffptr[i]],ccv->w.length - i)); } } tsv.buff.buffptr += skip;