Mercurial > hg > Game > Cerium
changeset 1776:1c429035e0d1 draft
Refactoring conditional expression
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Nov 2013 14:27:51 +0900 |
parents | 72e8c18bfbf6 |
children | 7b11aceb41c4 |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc |
diffstat | 2 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Sat Nov 23 18:00:06 2013 +0900 +++ b/example/regex_mas/main.cc Mon Nov 25 14:27:51 2013 +0900 @@ -45,7 +45,7 @@ static int division = 16; // in Kbyte //static unsigned char* search_word; CPU_TYPE spe_cpu = SPE_ANY; -const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-sw search_word] [-file filename]\n"; +const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-sw search_word] [-file filename]\n Required filename & search_word\n"; static double getTime() { @@ -155,7 +155,6 @@ t_exec[k]->set_inData(2,w->BMskip_table, sizeof(int)*256); t_exec[k]->set_outData(0,w->o_data + a*w->out_size, w->division_out_size); - w->size -= size; w->task_num--; } @@ -379,7 +378,7 @@ sword = (unsigned char*)argv[i+1]; } } - if (filename==0) { + if ((filename==0) || (sword==0)) { puts(usr_help_str); exit(1); } @@ -396,17 +395,14 @@ filename = init(argc, argv); + if ((filename < 0) || (sword < 0)) { + return -1; + } + int sw_len = strlen((const char*)sword); unsigned char *search_word = (unsigned char*)manager->allocate(sizeof(char)*sw_len); strcpy((char*)search_word, (const char*)sword); - if (filename < 0) { - return -1; - } - - if (search_word < 0) { - return -1; - } task_init(); st_time = getTime();