X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=test%2Funit%2Fprint_cmdtype_code%2Fprint_cmdtype_code.c;h=04d311e55e096d85a2d3c6fb2f67cc958def0c91;hp=bb31614a2942019344a192ed2f662b8772f73876;hb=4ee27a568fb9222907a566e59aaefe248f08a8e4;hpb=5562b8293058464957a1f833777e187a78220ed5 diff --git a/test/unit/print_cmdtype_code/print_cmdtype_code.c b/test/unit/print_cmdtype_code/print_cmdtype_code.c index bb31614..04d311e 100644 --- a/test/unit/print_cmdtype_code/print_cmdtype_code.c +++ b/test/unit/print_cmdtype_code/print_cmdtype_code.c @@ -4,8 +4,8 @@ int compare_code(const void *a, const void *b) { - const CMDCODEARRAY ca = **(const CMDCODEARRAY **)a; - const CMDCODEARRAY cb = **(const CMDCODEARRAY **)b; + const CMDTYPECODE ca = **(const CMDTYPECODE **)a; + const CMDTYPECODE cb = **(const CMDTYPECODE **)b; int diff; if((diff = strcmp(ca.cmd, cb.cmd)) == 0) { return ca.type - cb.type; @@ -19,12 +19,12 @@ void print_cmdtype_code() { int i, j = 0; CMDCODETAB *np; - CMDCODEARRAY **ar; - ar = malloc(sizeof(*ar) * cmdcodesize); + CMDTYPECODE **ar; + ar = malloc(sizeof(*ar) * cmdtypecodesize); for(i = 0; i < cmdtabsize; i++) { np = cmdtype_code[i]; while(np != NULL) { - ar[j++] = np->cca; + ar[j++] = np->cmdtypecode; np = np->next; } } @@ -36,11 +36,16 @@ void print_cmdtype_code() int main() { + /* エラーの初期化 */ + cerr = malloc_chk(sizeof(CERR), "cerr"); + /* ハッシュ表作成 */ create_cmdtype_code(); + /* 命令表の表示 */ print_cmdtype_code(); + /* ハッシュ表解放 */ free_cmdtype_code(); - if(cerrno != 0) { - printf("\terror - %d: %s\n", cerrno, cerrmsg); + if(cerr->num != 0) { + printf("\terror - %d: %s\n", cerr->num, cerr->msg); freecerr(); exit(-1); }