From: j8takagi Date: Sun, 10 Feb 2019 05:18:21 +0000 (+0900) Subject: ソースコードの推敲 X-Git-Tag: v0.5p3~4^2~1 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47bce10199bfd1545b94803ce653b3301103aee7;p=YACASL2.git ソースコードの推敲 --- diff --git a/src/assemble.c b/src/assemble.c index 33fd93e..daee475 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -441,7 +441,7 @@ void assemble_start(const CMDLINE *cmdl, PASS pass) setcerr(106, ""); /* operand count mismatch */ return; } - if(!*(cmdl->label)) { + if(!cmdl->label[0]) { setcerr(107, ""); /* no label in START */ return; } @@ -575,7 +575,7 @@ bool casl2cmd(CMD *cmdtbl, const CMDLINE *cmdl, PASS pass) { int i; void (*cmdptr)(); - for(i = 0; *(cmdtbl[i].name); i++) { + for(i = 0; cmdtbl[i].name[0]; i++) { if(strcmp(cmdl->cmd, cmdtbl[i].name) == 0) { cmdptr = cmdtbl[i].ptr; (*cmdptr)(cmdl, pass); @@ -675,7 +675,7 @@ bool assemble_comet2cmd(const CMDLINE *cmdl, PASS pass) bool assembletok(const CMDLINE *cmdl, PASS pass) { /* 命令がない場合 */ - if(!*(cmdl->cmd)) { + if(!cmdl->cmd[0]) { return true; } /* アセンブラ命令またはマクロ命令の書込 */ @@ -700,7 +700,7 @@ bool assembleline(const char *line, PASS pass) stat = (cerr->num == 0) ? true : false; if(cmdl != NULL) { if(stat == true) { - if(pass == FIRST && *(cmdl->label)) { + if(pass == FIRST && cmdl->label[0]) { stat = addlabel(asptr->prog, cmdl->label, asptr->ptr); } } diff --git a/src/exec.c b/src/exec.c index 8c9d566..f1b2f16 100644 --- a/src/exec.c +++ b/src/exec.c @@ -124,7 +124,7 @@ void svcin() setcerr(208, ""); /* SVC input - memory overflow */ break; } - sys->memory[sys->cpu->gr[1]+i] = *(buf + i); + sys->memory[sys->cpu->gr[1] + i] = buf[i]; } sys->memory[sys->cpu->gr[2]] = i + 1; FREE(buf); diff --git a/src/label.c b/src/label.c index f69bd45..9d34f77 100644 --- a/src/label.c +++ b/src/label.c @@ -147,7 +147,7 @@ void printlabel() } qsort(l, s, sizeof(*l), compare_adr); for(i = 0; i < s; i++) { - if(*(l[i]->prog)) { + if(l[i]->prog[0]) { fprintf(stdout, "%s.", l[i]->prog); } fprintf(stdout, "%s ---> #%04X\n", l[i]->label, l[i]->adr);