projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
トークンの処理を推敲
[YACASL2.git]
/
src
/
label.c
diff --git
a/src/label.c
b/src/label.c
index
63b6fe5
..
9d34f77
100644
(file)
--- 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;
int i = 0, j;
unsigned h;
- if(
*prog != '\0'
) {
+ if(
prog[0]
) {
keys[i++] = label_hashkey(prog);
}
keys[i] = label_hashkey(label);
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;
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;
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++) {
}
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);
fprintf(stdout, "%s.", l[i]->prog);
}
fprintf(stdout, "%s ---> #%04X\n", l[i]->label, l[i]->adr);
@@
-166,10
+166,8
@@
void freelabel()
FREE(p->label->prog);
FREE(p->label->label);
FREE(p->label);
FREE(p->label->prog);
FREE(p->label->label);
FREE(p->label);
- if(p == labels[i]) {
- labels[i] = NULL;
- }
FREE(p);
}
FREE(p);
}
+ labels[i] = NULL;
}
}
}
}