shithub: mc

Download patch

ref: 38483fdfd64a3f069e799c41581f227b3880f0c2
parent: 75ddf8edac3ea43fee7b7bdafe9e7799fb3571aa
author: Ori Bernstein <[email protected]>
date: Thu Dec 28 16:57:43 EST 2017

Minor cleanup.

--- a/6/simp.c
+++ b/6/simp.c
@@ -288,15 +288,6 @@
 	return t;
 }
 
-static void
-cjmp(Simp *s, Node *cond, Node *iftrue, Node *iffalse)
-{
-	Node *jmp;
-
-	jmp = mkexpr(cond->loc, Ocjmp, cond, iftrue, iffalse, NULL);
-	append(s, jmp);
-}
-
 static Node *
 slicelen(Simp *s, Node *sl)
 {
@@ -446,7 +437,7 @@
 static void
 checkidx(Simp *s, Op op, Node *len, Node *idx)
 {
-	Node *cmp, *die;
+	Node *cmp, *die, *jmp;
 	Node *ok, *fail;
 
 	if (!len)
@@ -460,7 +451,8 @@
 	die->expr.type = mktype(len->loc, Tyvoid);
 
 	/* insert them */
-	cjmp(s, cmp, ok, fail);
+	jmp = mkexpr(idx->loc, Ocjmp, cmp, ok, fail, NULL);
+	append(s, jmp);
 	append(s, fail);
 	append(s, die);
 	append(s, ok);
--- a/lib/regex/compile.myr
+++ b/lib/regex/compile.myr
@@ -105,6 +105,7 @@
 	/* all the threads should be dead,
 	 so we shouldn't have to free any*/
 	std.slfree(re.prog)
+	std.slfree(re.code)
 	if re.debug
 		std.htfree(re.astloc)
 		std.slfree(re.pcidx)