aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-19 18:32:28 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-21 13:19:46 +0200
commite9b426db412680de1888056c5a643b3ed8c7ded6 (patch)
treec2482e1325e3ee50e55c7441e619ec63070db8f8
parent53810d61f20296ce9ef207811e1180b6d10d7a24 (diff)
downloadell-e9b426db412680de1888056c5a643b3ed8c7ded6.tar.gz
ell-e9b426db412680de1888056c5a643b3ed8c7ded6.tar.xz
ell-e9b426db412680de1888056c5a643b3ed8c7ded6.zip
Parsing should not create a new list
The resulting program is already a sequence.
-rwxr-xr-xell.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ell.c b/ell.c
index c1f784f..7370eea 100755
--- a/ell.c
+++ b/ell.c
@@ -630,7 +630,7 @@ parse (const char *s, size_t len, char **e) {
print_tree (result, 0);
printf ("\n\n");
#endif
- return new_list (result);
+ return result;
}
// --- Runtime -----------------------------------------------------------------
@@ -1006,7 +1006,7 @@ main (int argc, char *argv[]) {
fclose (fp);
char *e = NULL;
- struct item *tree = parse (buf.s, buf.len, &e);
+ struct item *program = parse (buf.s, buf.len, &e);
free (buf.s);
if (e) {
printf ("%s: %s\n", "parse error", e);
@@ -1021,9 +1021,9 @@ main (int argc, char *argv[]) {
printf ("%s\n", "runtime library initialization failed");
struct item *result = NULL;
- (void) execute (&ctx, tree->head, &result);
+ (void) execute (&ctx, program, &result);
item_free_list (result);
- item_free_list (tree);
+ item_free_list (program);
const char *failure = NULL;
if (ctx.memory_failure)