summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mi/match.c12
-rw-r--r--mkfile4
2 files changed, 12 insertions, 4 deletions
diff --git a/mi/match.c b/mi/match.c
index c644afc..be0e033 100644
--- a/mi/match.c
+++ b/mi/match.c
@@ -21,7 +21,7 @@ struct Dtree {
size_t nval;
Node **load; /* expression value being compared */
size_t nload;
- Dtree **sub; /* submatche to use if if equal */
+ Dtree **sub; /* submatch to use if if equal */
size_t nsub;
Dtree *any; /* tree for a wildcard match. */
@@ -116,8 +116,12 @@ static Dtree *addunion(Dtree *t, Node *pat, Node *val, Node ***cap, size_t *ncap
/* if we have the value already... */
sub = NULL;
for (i = 0; i < t->nval; i++) {
- if (nameeq(t->val[i], pat->expr.args[0]))
- return addpat(t->sub[i], pat->expr.args[1], NULL, cap, ncap);
+ if (nameeq(t->val[i], pat->expr.args[0])) {
+ if (pat->expr.nargs > 1)
+ return addpat(t->sub[i], pat->expr.args[1], NULL, cap, ncap);
+ else
+ return t->sub[i];
+ }
}
sub = mkdtree();
@@ -138,7 +142,7 @@ static Dtree *addlit(Dtree *t, Node *pat, Node *val, Node ***cap, size_t *ncap)
return t->any;
for (i = 0; i < t->nval; i++) {
if (liteq(t->val[i]->expr.args[0], pat->expr.args[0]))
- return addpat(t->sub[i], pat->expr.args[1], NULL, cap, ncap);
+ return t->sub[i];
}
sub = mkdtree();
diff --git a/mkfile b/mkfile
index 2a580b6..748d1e0 100644
--- a/mkfile
+++ b/mkfile
@@ -40,6 +40,10 @@ uninstall:V: $SUB config.h
mk $MKFLAGS
}
+check:V:
+ cd test
+ mk check
+
config.h:
echo '#define Instroot "/amd64"' > config.h
echo '#define Asmcmd {"6a", "-o", NULL}' >> config.h