shithub: mc

Download patch

ref: 2cd9927f90410e345fab398fe2573fe6971ef3b0
parent: 92847c0604e5f4fa790b1783595e8a503ad271be
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Aug 11 18:35:08 EDT 2018

We don't need early breaks.

--- a/mi/match.c
+++ b/mi/match.c
@@ -248,14 +248,11 @@
 	if (t->accept || t->any == accept)
 		return 0;
 
-	ret = 0;
-	if (t->any) {
-		if (acceptall(t->any, accept))
-			ret = 1;
-	} else {
+	ret = 1;
+	if (t->any)
+		ret = acceptall(t->any, accept);
+	else
 		t->any = accept;
-		ret = 1;
-	}
 
 	for (i = 0; i < t->nnext; i++)
 		if (acceptall(t->next[i], accept))
@@ -320,8 +317,6 @@
 			lfree(&last, &nlast);
 			last = tail;
 			nlast = ntail;
-			if (i == ty->nsub - 1)
-				break;
 		}
 		break;
 	case Tyarray:
@@ -338,8 +333,6 @@
 			lfree(&last, &nlast);
 			last = tail;
 			nlast = ntail;
-			if (i == nelt - 1)
-				break;
 		}
 		break;
 	case Tystruct:
@@ -354,8 +347,6 @@
 			lfree(&last, &nlast);
 			last = tail;
 			nlast = ntail;
-			if (i == ty->nsub - 1)
-				break;
 		}
 		break;
 	case Tyunion: