This patch also corrects a heap-corruption bug in unique_free.
Freeing the variables accelerates compilation of the regular patch
set by about 35-40 ms.
---
src/compiler/compiler.c | 2 ++
src/compiler/unique.c | 1 +
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c
index 1d3ac7b..e8a0f62 100644
--- a/src/compiler/compiler.c
+++ b/src/compiler/compiler.c
@@ -27,6 +27,7 @@
#include <fpvm/pfpu.h>
#include "../pixbuf/pixbuf.h"
+#include "unique.h"
#include "compiler.h"
struct compiler_sc {
@@ -762,6 +763,7 @@ struct patch *patch_compile(const char *basedir, const char
*patch_code,
goto fail;
}
free(patch_code_copy);
+ unique_free();
if(!finalize_pfv(sc)) goto fail;
if(!schedule_pfv(sc)) goto fail;
diff --git a/src/compiler/unique.c b/src/compiler/unique.c
index c571f6d..a34ce53 100644
--- a/src/compiler/unique.c
+++ b/src/compiler/unique.c
@@ -133,5 +133,6 @@ void unique_free(void)
for(i = 0; i != num_vars; i++)
free((void *) vars[i]);
free(vars);
+ vars = NULL;
num_vars = allocated = 0;
}
--
1.7.1
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode