shithub: mc

Download patch

ref: 3920112fb1060bed3ebecff443d9887330ef0348
parent: c2fe43f61c7d2a8277247db8314bb3d5a4ffb753
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jan 2 10:17:34 EST 2016

Don't double label BBs.

	If we've already got a BB with a specific label, don't add
	that label again.

	Fixes #28

--- a/mi/cfg.c
+++ b/mi/cfg.c
@@ -29,8 +29,10 @@
 
 static void strlabel(Cfg *cfg, char *lbl, Bb *bb)
 {
-	htput(cfg->lblmap, lbl, bb);
-	lappend(&bb->lbls, &bb->nlbls, lbl);
+	if (htget(cfg->lblmap, lbl) != bb) {
+		htput(cfg->lblmap, lbl, bb);
+		lappend(&bb->lbls, &bb->nlbls, lbl);
+	}
 }
 
 static void label(Cfg *cfg, Node *lbl, Bb *bb)