Mercurial > hg > Applications > Grep
diff regexParser/generateSequentialSearch.cc @ 241:87ad91af8a15
turn initialization in charclasswalk
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Jan 2016 20:28:40 +0900 |
parents | 2081b9d6a179 |
children | 6aebc4d7dd75 |
line wrap: on
line diff
--- a/regexParser/generateSequentialSearch.cc Wed Jan 20 18:20:48 2016 +0900 +++ b/regexParser/generateSequentialSearch.cc Wed Jan 20 20:28:40 2016 +0900 @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include "generateSequentialSearch.h" #include "subsetConstruction.h" @@ -6,6 +7,11 @@ void exportState(TransitionGeneratorPtr tg) { StatePtr state = tg->stateList; FILE *fp = fopen("state.cc","w"); + if (fp==NULL) { + perror(""); + fprintf(stderr,"cannot write state.cc\n"); + exit(1); + } for (;state;state = state->next) { fprintf(fp,"void state%lx(Buffer buff);\n",state->bitState.bitContainer); } @@ -37,7 +43,8 @@ fprintf(fp," else if (c<='%c') state%lx(buff);\n",(unsigned char)end, bi.bitContainer); } } - if (state->bitState.bitContainer == 2) { + free(ccw); + if (state->bitState.bitContainer & 2) { fprintf(fp," else stateMatch(buff);\n"); } else { fprintf(fp," else stateSkip(buff);\n");