comparison regexParser/cerium/ppe/Exec.cc @ 275:8879eb8c64a8

remove segmentation fault
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Sat, 30 Jan 2016 19:06:41 +0900
parents 5aa9d01926f1
children 99d635926ef3
comparison
equal deleted inserted replaced
273:bc704a31e842 275:8879eb8c64a8
39 tsv.buff = buff; 39 tsv.buff = buff;
40 tsv.tg = tg; 40 tsv.tg = tg;
41 tsv.result = NULL; 41 tsv.result = NULL;
42 tsv.resultEnd = &tsv.result; 42 tsv.resultEnd = &tsv.result;
43 tsv.current = tg->anyState->tState; 43 tsv.current = tg->anyState->tState;
44 tsv.current->stateSkip = stateSkip;
45 tsv.current->stateContinue = stateNothing;
44 tsv.tg->stateSkip = stateSkip; 46 tsv.tg->stateSkip = stateSkip;
45 tsv.tg->stateMatch = stateMatch; 47 tsv.tg->stateMatch = stateMatch;
46 tsv.tg->stateNothing = stateNothing; 48 tsv.tg->stateNothing = stateNothing;
47 unsigned char *end = buff.buffend; 49 unsigned char *end = buff.buffend;
48 buff.buffend = buff.buff+1; 50 buff.buffend = buff.buff+1;
65 static int 67 static int
66 blockedGrep(SchedTask *s, void *rbuf, void *wbuf) 68 blockedGrep(SchedTask *s, void *rbuf, void *wbuf)
67 { 69 {
68 long task_spwaned = (long)s->get_param(0); 70 long task_spwaned = (long)s->get_param(0);
69 long division_size = (long)s->get_param(1); 71 long division_size = (long)s->get_param(1);
70 // long length = (long)s->get_param(2); 72 long length = (long)s->get_param(2);
71 long out_size = (long)s->get_param(3); 73 long out_size = (long)s->get_param(3);
72 MapReduce *w = (MapReduce*)s->get_param(4); 74 MapReduce *w = (MapReduce*)s->get_param(4);
73 long allocation = task_spwaned + (long)s->x; 75 long allocation = task_spwaned + (long)s->x;
74 unsigned char* i_data; 76 unsigned char* i_data;
75 unsigned long * o_data; 77 unsigned long * o_data;
81 o_data = (unsigned long *)s->get_output(0); 83 o_data = (unsigned long *)s->get_output(0);
82 } 84 }
83 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global; 85 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)w->global;
84 Buffer buff; 86 Buffer buff;
85 buff.buff = buff.buffptr = buff.matchBegin = i_data; 87 buff.buff = buff.buffptr = buff.matchBegin = i_data;
86 buff.buffend = buff.buff + division_size; 88 buff.buffend = buff.buff + length;
87 TSValue tsv = blockSearch(tg,buff); 89 TSValue tsv = blockSearch(tg,buff);
88 o_data[0] = (unsigned long)tsv.result; 90 o_data[0] = (unsigned long)tsv.result;
89 o_data[1] = (unsigned long)tsv.blockBegin; 91 o_data[1] = (unsigned long)tsv.blockBegin->state;
90 o_data[2] = (unsigned long)tsv.blockEnd; 92 o_data[2] = (unsigned long)tsv.blockEnd->state;
91 return 0; 93 return 0;
92 } 94 }