From: j8takagi Date: Thu, 28 Apr 2011 12:22:43 +0000 (+0900) Subject: ラベルの空文字を、NULLから'\0'へ X-Git-Tag: v0.1p46 X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=commitdiff_plain;h=d28cabe954c1f93dee3cb1b100e614e985a74cdb ラベルの空文字を、NULLから'\0'へ --- diff --git a/src/assemble.c b/src/assemble.c index 23ce8ac..9227114 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -257,7 +257,7 @@ void assemble_start(const CMDLINE *cmdl, PASS pass) setcerr(106, ""); /* operand count mismatch */ return; } - if(cmdl->label == '\0') { + if(*(cmdl->label) == '\0') { setcerr(107, ""); /* no label in START */ return; } @@ -604,7 +604,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 != '\0') { + if(pass == FIRST && *(cmdl->label) != '\0') { stat = addlabel(asptr->prog, cmdl->label, asptr->ptr); } } diff --git a/src/token.c b/src/token.c index c9078d2..074b6c4 100644 --- a/src/token.c +++ b/src/token.c @@ -125,7 +125,7 @@ CMDLINE *linetok(const char *line) cmdl->label = malloc_chk(LABELSIZE + 1, "cmdl.label"); /* ラベルの取得。行の先頭が空白またはタブの場合、ラベルは空 */ if((sepp = p + strcspn(p, " \t\n")) == p){ - cmdl->label = '\0'; + *(cmdl->label) = '\0'; } else { /* ラベルを取得 */ *sepp = '\0'; /* 文字列が長すぎる場合はエラー */ @@ -141,7 +141,7 @@ CMDLINE *linetok(const char *line) } /* 命令とオペランドの取得 */ if(*p == '\n' || *p == '\0') { /* 命令がない場合は、終了 */ - if(cmdl->label != '\0') { /* ラベルが定義されていて命令がない場合はエラー */ + if(*(cmdl->label) != '\0') { /* ラベルが定義されていて命令がない場合はエラー */ setcerr(105, ""); /* no command in the line */ } FREE(cmdl->label);