Mercurial > hg > Applications > Grep
comparison regexParser/cerium/ppe/Print.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 | 6cc1d9779f45 |
comparison
equal
deleted
inserted
replaced
273:bc704a31e842 | 275:8879eb8c64a8 |
---|---|
16 | 16 |
17 int out_size = w->division_out_size / sizeof(unsigned long long); | 17 int out_size = w->division_out_size / sizeof(unsigned long long); |
18 int out_task_num = w->task_num; | 18 int out_task_num = w->task_num; |
19 ResultPtr prev = NULL; | 19 ResultPtr prev = NULL; |
20 for (int i = 0; i < out_task_num ; i++) { | 20 for (int i = 0; i < out_task_num ; i++) { |
21 ResultPtr *idata = (ResultPtr*)w->o_data[i*3+0]; | 21 ResultPtr r = (ResultPtr)w->o_data[i*out_size+0]; |
22 StatePtr blockEnd = (StatePtr)w->o_data[i*3+2]; | 22 StatePtr blockEnd = (StatePtr)w->o_data[i*out_size+2]; |
23 StatePtr blockBegin = (StatePtr)w->o_data[i*3+4]; // next Block's blockBegin. | 23 StatePtr blockBegin = (StatePtr)w->o_data[i*out_size+4]; // next Block's blockBegin. |
24 ResultPtr r = idata[i*out_size]; | |
25 if (prev && i != out_task_num-1) { | 24 if (prev && i != out_task_num-1) { |
26 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) | 25 // 最後のブロックでなく、前の blockEnd が state 1 でない場合) |
27 if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { | 26 if ((blockBegin->bitState.bitContainer & ~blockEnd->bitState.bitContainer)==0) { |
28 // 前のブロックの matchBegin から最初 result の end までがマッチ | 27 // 前のブロックの matchBegin から最初 result の end までがマッチ |
29 fwrite(prev->begin,r->end - prev->begin,1,stdout); | 28 fwrite(prev->begin,r->end - prev->begin,1,stdout); |