diff directive.c @ 38:b156910b59b2

Wrap free() in dofree() to allow instrumenting it for debugging.
author David A. Holland
date Sat, 30 Mar 2013 21:02:25 -0400
parents a489cc223483
children 337110e7240a
line wrap: on
line diff
--- a/directive.c	Sat Mar 30 20:52:59 2013 -0400
+++ b/directive.c	Sat Mar 30 21:02:25 2013 -0400
@@ -94,7 +94,7 @@
 void
 ifstate_destroy(struct ifstate *is)
 {
-	free(is);
+	dofree(is);
 }
 
 static
@@ -126,7 +126,7 @@
 	expr = macroexpand(p2, line, len, true);
 	val = eval(&p3, expr);
 	ifstate_push(p, val);
-	free(expr);
+	dofree(expr);
 }
 
 static
@@ -163,7 +163,7 @@
 		expr = macroexpand(p2, line, len, true);
 		ifstate->curtrue = eval(&p3, expr);
 		ifstate->evertrue = ifstate->curtrue;
-		free(expr);
+		dofree(expr);
 	}
 }
 
@@ -298,10 +298,10 @@
 	}
 	text = macroexpand(p2, line, len, false);
 	if (tryinclude(p, text, strlen(text))) {
-		free(text);
+		dofree(text);
 		return;
 	}
-	free(text);
+	dofree(text);
 	complain(p, "Illegal #include directive");
 	complain_fail();
 }
@@ -328,7 +328,7 @@
 	if (mode.werror) {
 		complain_fail();
 	}
-	free(msg);
+	dofree(msg);
 }
 
 static
@@ -340,7 +340,7 @@
 	msg = macroexpand(p2, line, len, false);
 	complain(p, "#error: %s", msg);
 	complain_fail();
-	free(msg);
+	dofree(msg);
 }
 
 ////////////////////////////////////////////////////////////