X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Flabel.c;h=9d34f771791053cb4e0fc5921def7ebe939c1181;hp=cbb27b815d1ac720d630f394573cbe4511da3c9c;hb=065d340f994652a9759c496b4c024e1f9a3a6783;hpb=a46594d66972fae37a609506bcf01f6b2bdc865e diff --git a/src/label.c b/src/label.c index cbb27b8..9d34f77 100644 --- a/src/label.c +++ b/src/label.c @@ -63,7 +63,7 @@ unsigned labelhash(const char *prog, const char *label) int i = 0, j; unsigned h; - if(*prog != '\0') { + if(prog[0]) { keys[i++] = label_hashkey(prog); } keys[i] = label_hashkey(label); @@ -94,7 +94,7 @@ WORD getlabel(const char *prog, const char *label) for(p = labels[labelhash(prog, label)]; p != NULL; p = p->next) { l = p->label; - if((*prog == '\0' || (strcmp(prog, l->prog) == 0)) && + if((!prog[0] || (strcmp(prog, l->prog) == 0)) && strcmp(label, l->label) == 0) { return l->adr; @@ -147,7 +147,7 @@ void printlabel() } qsort(l, s, sizeof(*l), compare_adr); for(i = 0; i < s; i++) { - if(*(l[i]->prog) != '\0') { + if(l[i]->prog[0]) { fprintf(stdout, "%s.", l[i]->prog); } fprintf(stdout, "%s ---> #%04X\n", l[i]->label, l[i]->adr); @@ -168,5 +168,6 @@ void freelabel() FREE(p->label); FREE(p); } + labels[i] = NULL; } }