ラベルの空文字を、NULLから'\0'へ v0.1p46
authorj8takagi <j8takagi@nifty.com>
Thu, 28 Apr 2011 12:22:43 +0000 (21:22 +0900)
committerj8takagi <j8takagi@nifty.com>
Thu, 28 Apr 2011 12:22:43 +0000 (21:22 +0900)
src/assemble.c
src/token.c

index 23ce8ac..9227114 100644 (file)
@@ -257,7 +257,7 @@ void assemble_start(const CMDLINE *cmdl, PASS pass)
         setcerr(106, "");    /* operand count mismatch */
         return;
     }
         setcerr(106, "");    /* operand count mismatch */
         return;
     }
-    if(cmdl->label == '\0') {
+    if(*(cmdl->label) == '\0') {
         setcerr(107, "");    /* no label in START */
         return;
     }
         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) {
     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);
             }
         }
                 stat = addlabel(asptr->prog, cmdl->label, asptr->ptr);
             }
         }
index c9078d2..074b6c4 100644 (file)
@@ -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 = malloc_chk(LABELSIZE + 1, "cmdl.label");
         /* ラベルの取得。行の先頭が空白またはタブの場合、ラベルは空 */
         if((sepp = p + strcspn(p, " \t\n")) == p){
-            cmdl->label = '\0';
+            *(cmdl->label) = '\0';
         } else {        /* ラベルを取得 */
             *sepp = '\0';
             /* 文字列が長すぎる場合はエラー */
         } else {        /* ラベルを取得 */
             *sepp = '\0';
             /* 文字列が長すぎる場合はエラー */
@@ -141,7 +141,7 @@ CMDLINE *linetok(const char *line)
         }
         /* 命令とオペランドの取得 */
         if(*p == '\n' || *p == '\0') {        /* 命令がない場合は、終了 */
         }
         /* 命令とオペランドの取得 */
         if(*p == '\n' || *p == '\0') {        /* 命令がない場合は、終了 */
-            if(cmdl->label != '\0') {         /* ラベルが定義されていて命令がない場合はエラー */
+            if(*(cmdl->label) != '\0') {      /* ラベルが定義されていて命令がない場合はエラー */
                 setcerr(105, "");    /* no command in the line */
             }
             FREE(cmdl->label);
                 setcerr(105, "");    /* no command in the line */
             }
             FREE(cmdl->label);