---
src/compiler/ptest/ptest.c | 29 ++++++++++++++++++++++-------
1 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/src/compiler/ptest/ptest.c b/src/compiler/ptest/ptest.c
index c45d84a..e86ca2b 100644
--- a/src/compiler/ptest/ptest.c
+++ b/src/compiler/ptest/ptest.c
@@ -266,16 +266,10 @@ static void dump_regs(const int *alloc, const char
(*names)[FPVM_MAXSYMLEN],
}
-static void compile(const char *pgm)
+static void show_patch(const struct patch *patch)
{
- struct patch *patch;
int i;
- patch = patch_compile("/", pgm, report);
- if (!patch)
- exit(1);
- if (quiet)
- return;
printf("global:\n");
for (i = 0; i != COMP_PFV_COUNT; i++)
if (patch->pfv_initial[i])
@@ -292,6 +286,24 @@ static void compile(const char *pgm)
}
+static void compile(const char *pgm)
+{
+ struct patch *patch;
+
+ patch = patch_compile("/", pgm, report);
+ if (!patch)
+ exit(1);
+ if (!quiet)
+ show_patch(patch);
+ /*
+ * We can't use patch_free here because that function also accesses
+ * image data, which isn't available in standalone builds. A simple
+ * free(3) has the same effect in this case.
+ */
+ free(patch);
+}
+
+
static void usage(const char *name)
{
fprintf(stderr,
@@ -354,5 +366,8 @@ int main(int argc, char **argv)
parse_only(buf);
}
+ if (argc == optind)
+ free((void *) buf);
+
return 0;
}
--
1.7.1
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode